staging: tidspbridge: fix incorrect free to drv_datap
authorOmar Ramirez Luna <omar.ramirez@ti.com>
Tue, 31 Jan 2012 01:20:18 +0000 (19:20 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 Feb 2012 22:14:14 +0000 (14:14 -0800)
This structure is still used after it has been freed, since it
is being allocated in probe, calls to free it have been moved to
module's remove routine.

This should fix the follwoing messages when attempting to remove the
module:
 drv_get_first_dev_extension: Failed to retrieve the object handle
 drv_get_first_dev_extension: Failed to retrieve the object handle
 drv_destroy: Failed to store DRV object
 mgr_destroy: Failed to store MGR object

Signed-off-by: Omar Ramirez Luna <omar.ramirez@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/tidspbridge/core/tiomap3430.c
drivers/staging/tidspbridge/rmgr/drv_interface.c

index e1c4492a71052970c76f3592041cb5f37a80fcbe..dde559d06c43740be42b32add7f71e7b89f61379 100644 (file)
@@ -1046,8 +1046,6 @@ static int bridge_dev_destroy(struct bridge_dev_context *dev_ctxt)
 
        /* Free the driver's device context: */
        kfree(drv_datap->base_img);
-       kfree(drv_datap);
-       dev_set_drvdata(bridge, NULL);
        kfree((void *)dev_ctxt);
        return status;
 }
index 8bac511c627f922aeab90e7e1289c0a64767b083..385740bad0de7250bba9ec69bd311e5e5b2866e6 100644 (file)
@@ -410,6 +410,9 @@ static int __devexit omap34_xx_bridge_remove(struct platform_device *pdev)
                DBC_ASSERT(ret == true);
        }
 
+       kfree(drv_datap);
+       dev_set_drvdata(bridge, NULL);
+
 func_cont:
        mem_ext_phys_pool_release();