diff mbox

[2/4] dspbridge: dev: fix dev_create_device()

Message ID 1274024702-20961-3-git-send-email-felipe.contreras@gmail.com (mailing list archive)
State Accepted
Delegated to:
Headers show

Commit Message

Felipe Contreras May 16, 2010, 3:45 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/dsp/bridge/pmgr/dev.c b/drivers/dsp/bridge/pmgr/dev.c
index c85a4fa..4ba8197 100644
--- a/drivers/dsp/bridge/pmgr/dev.c
+++ b/drivers/dsp/bridge/pmgr/dev.c
@@ -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;
 	}