@@ -27,7 +27,7 @@
#include <dspbridge/dehdefs.h>
-extern dsp_status bridge_deh_create(struct deh_mgr **phDehMgr,
+extern dsp_status bridge_deh_create(struct deh_mgr **ret_deh_mgr,
struct dev_object *hdev_obj);
extern dsp_status bridge_deh_destroy(struct deh_mgr *hdeh_mgr);
@@ -62,11 +62,11 @@ static struct hw_mmu_map_attrs_t map_attrs = {
static u32 dummy_va_addr;
-dsp_status bridge_deh_create(struct deh_mgr **phDehMgr,
+dsp_status bridge_deh_create(struct deh_mgr **ret_deh_mgr,
struct dev_object *hdev_obj)
{
dsp_status status = DSP_SOK;
- struct deh_mgr *deh_mgr_obj = NULL;
+ struct deh_mgr *deh_mgr_obj;
struct cfg_hostres cfg_host_res;
struct cfg_devnode *dev_node_obj;
struct wmd_dev_context *hwmd_context = NULL;
@@ -83,7 +83,7 @@ dsp_status bridge_deh_create(struct deh_mgr **phDehMgr,
dummy_va_addr = 0;
/* Allocate IO manager object: */
MEM_ALLOC_OBJECT(deh_mgr_obj, struct deh_mgr, SIGNATURE);
- if (deh_mgr_obj == NULL) {
+ if (!deh_mgr_obj) {
status = DSP_EMEMORY;
goto leave;
}
@@ -96,17 +96,17 @@ dsp_status bridge_deh_create(struct deh_mgr **phDehMgr,
(u32) deh_mgr_obj);
if (DSP_FAILED(status))
- goto leave;
+ goto err;
status = dev_get_dev_node(hdev_obj, &dev_node_obj);
if (DSP_FAILED(status))
- goto leave;
+ goto err;
status = cfg_get_host_resources(dev_node_obj, &cfg_host_res);
if (DSP_FAILED(status))
- goto leave;
+ goto err;
/* Fill in context structure */
deh_mgr_obj->hwmd_context = hwmd_context;
@@ -114,6 +114,7 @@ dsp_status bridge_deh_create(struct deh_mgr **phDehMgr,
deh_mgr_obj->err_info.dw_val1 = 0L;
deh_mgr_obj->err_info.dw_val2 = 0L;
deh_mgr_obj->err_info.dw_val3 = 0L;
+
/* Install ISR function for DSP MMU fault */
if ((request_irq(INT_DSP_MMU_IRQ, mmu_fault_isr, 0,
"DspBridge\tiommu fault",
@@ -122,15 +123,16 @@ dsp_status bridge_deh_create(struct deh_mgr **phDehMgr,
else
status = DSP_EFAIL;
-leave:
+err:
if (DSP_FAILED(status)) {
/* If create failed, cleanup */
bridge_deh_destroy((struct deh_mgr *)deh_mgr_obj);
- *phDehMgr = NULL;
- } else {
- *phDehMgr = (struct deh_mgr *)deh_mgr_obj;
+ deh_mgr_obj = NULL;
}
+leave:
+ *ret_deh_mgr = deh_mgr_obj;
+
return status;
}