summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Baltieri <fabio.baltieri@linaro.org>2013-04-03 12:45:03 +0400
committerFelipe Balbi <balbi@ti.com>2013-04-03 12:55:48 +0400
commit81ef6724302e0c7ba3f087403de24760601b1839 (patch)
treee1e8904f1db20a1b951e4d4409377196f8bc8470
parent3ee1f2e6e51581d5cb9c312161a9a9b2f18f25bf (diff)
downloadlinux-81ef6724302e0c7ba3f087403de24760601b1839.tar.xz
usb: phy: ab8500-usb: convert to devm_kzalloc
Convert local data allocation to devm_kzalloc and drop unnecessary fail path code. Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r--drivers/usb/phy/phy-ab8500-usb.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c
index 351b0369a611..ab6dd072ae25 100644
--- a/drivers/usb/phy/phy-ab8500-usb.c
+++ b/drivers/usb/phy/phy-ab8500-usb.c
@@ -628,15 +628,13 @@ static int ab8500_usb_probe(struct platform_device *pdev)
return -ENODEV;
}
- ab = kzalloc(sizeof *ab, GFP_KERNEL);
+ ab = devm_kzalloc(&pdev->dev, sizeof(*ab), GFP_KERNEL);
if (!ab)
return -ENOMEM;
- otg = kzalloc(sizeof *otg, GFP_KERNEL);
- if (!otg) {
- kfree(ab);
+ otg = devm_kzalloc(&pdev->dev, sizeof(*otg), GFP_KERNEL);
+ if (!otg)
return -ENOMEM;
- }
ab->dev = &pdev->dev;
ab->ab8500 = ab8500;
@@ -665,12 +663,12 @@ static int ab8500_usb_probe(struct platform_device *pdev)
err = ab8500_usb_irq_setup(pdev, ab);
if (err < 0)
- goto fail;
+ return err;
err = usb_add_phy(&ab->phy, USB_PHY_TYPE_USB2);
if (err) {
dev_err(&pdev->dev, "Can't register transceiver\n");
- goto fail;
+ return err;
}
/* Needed to enable ID detection. */
@@ -679,10 +677,6 @@ static int ab8500_usb_probe(struct platform_device *pdev)
dev_info(&pdev->dev, "revision 0x%2x driver initialized\n", rev);
return 0;
-fail:
- kfree(otg);
- kfree(ab);
- return err;
}
static int ab8500_usb_remove(struct platform_device *pdev)
@@ -700,9 +694,6 @@ static int ab8500_usb_remove(struct platform_device *pdev)
platform_set_drvdata(pdev, NULL);
- kfree(ab->phy.otg);
- kfree(ab);
-
return 0;
}