aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/phy
diff options
context:
space:
mode:
authorHimangi Saraogi <himangi774@gmail.com>2014-08-11 01:29:37 +0530
committerFelipe Balbi <balbi@ti.com>2014-08-19 09:21:34 -0500
commit0c5824083b8ca4aff083dc74024d0bfd46f9da9d (patch)
tree849240e6829d4db6b51ce93b305cbcb79119da76 /drivers/usb/phy
parentusb: phy: return -ENODEV on failure of try_module_get (diff)
downloadlinux-dev-0c5824083b8ca4aff083dc74024d0bfd46f9da9d.tar.xz
linux-dev-0c5824083b8ca4aff083dc74024d0bfd46f9da9d.zip
usb: phy: drop kfree of devm_kzalloc's data
Using kfree to free data allocated with devm_kzalloc causes double frees. The Coccinelle semantic patch that fixes this problem is as follows: // <smpl> @@ expression x; @@ x = devm_kzalloc(...) ... ?-kfree(x); // </smpl> Reviewed-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Himangi Saraogi <himangi774@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/phy')
-rw-r--r--drivers/usb/phy/phy-gpio-vbus-usb.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/usb/phy/phy-gpio-vbus-usb.c b/drivers/usb/phy/phy-gpio-vbus-usb.c
index ea9e705555df..f4b14bd97e14 100644
--- a/drivers/usb/phy/phy-gpio-vbus-usb.c
+++ b/drivers/usb/phy/phy-gpio-vbus-usb.c
@@ -260,10 +260,8 @@ static int gpio_vbus_probe(struct platform_device *pdev)
gpio_vbus->phy.otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg),
GFP_KERNEL);
- if (!gpio_vbus->phy.otg) {
- kfree(gpio_vbus);
+ if (!gpio_vbus->phy.otg)
return -ENOMEM;
- }
platform_set_drvdata(pdev, gpio_vbus);
gpio_vbus->dev = &pdev->dev;