From: Lukasz Majewski Date: Fri, 4 May 2012 12:17:13 +0000 (+0200) Subject: usb:hsotg:samsung: Add release function for hsotg device X-Git-Tag: upstream/snapshot3+hdmi~7443^2~139^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f026a52d4309e1e08752a8bd41ac74aeea815686;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git usb:hsotg:samsung: Add release function for hsotg device Add release function to prevent kernel warning. Kfree is performed when all references are gone. Signed-off-by: Sangwook Lee Signed-off-by: Lukasz Majewski Signed-off-by: Kyungmin Park Signed-off-by: Felipe Balbi --- diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index cd7ae3a..520dc3d 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -3445,9 +3445,21 @@ static void __devexit s3c_hsotg_delete_debug(struct s3c_hsotg *hsotg) } /** + * s3c_hsotg_release - release callback for hsotg device + * @dev: Device to for which release is called + */ +static void s3c_hsotg_release(struct device *dev) +{ + struct s3c_hsotg *hsotg = dev_get_drvdata(dev); + + kfree(hsotg); +} + +/** * s3c_hsotg_probe - probe function for hsotg driver * @pdev: The platform information for the driver */ + static int __devinit s3c_hsotg_probe(struct platform_device *pdev) { struct s3c_hsotg_plat *plat = pdev->dev.platform_data; @@ -3531,6 +3543,7 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev) hsotg->gadget.dev.parent = dev; hsotg->gadget.dev.dma_mask = dev->dma_mask; + hsotg->gadget.dev.release = s3c_hsotg_release; /* reset the system */ @@ -3678,7 +3691,6 @@ static int __devexit s3c_hsotg_remove(struct platform_device *pdev) clk_put(hsotg->clk); device_unregister(&hsotg->gadget.dev); - kfree(hsotg); return 0; }