@@ -149,9 +149,11 @@ dsp_status dev_create_device(OUT struct dev_object **phDevObject,
status = drv_request_bridge_res_dsp((void *)&host_res);
- if (DSP_FAILED(status))
+ if (DSP_FAILED(status)) {
dev_dbg(bridge, "%s: Failed to reserve bridge resources\n",
__func__);
+ goto leave;
+ }
/* Get the WMD interface functions */
bridge_drv_entry(&drv_fxns, driver_file_name);
@@ -256,20 +258,20 @@ dsp_status dev_create_device(OUT struct dev_object **phDevObject,
else
INIT_LIST_HEAD(&dev_obj->proc_list->head);
}
+leave:
/* If all went well, return a handle to the dev object;
* else, cleanup and return NULL in the OUT parameter. */
if (DSP_SUCCEEDED(status)) {
*phDevObject = dev_obj;
} else {
- kfree(dev_obj->proc_list);
-
- if (dev_obj && dev_obj->cod_mgr)
- cod_delete(dev_obj->cod_mgr);
-
- if (dev_obj && dev_obj->dmm_mgr)
- dmm_destroy(dev_obj->dmm_mgr);
-
- kfree(dev_obj);
+ if (dev_obj) {
+ kfree(dev_obj->proc_list);
+ if (dev_obj->cod_mgr)
+ cod_delete(dev_obj->cod_mgr);
+ if (dev_obj->dmm_mgr)
+ dmm_destroy(dev_obj->dmm_mgr);
+ kfree(dev_obj);
+ }
*phDevObject = NULL;
}