Commit 81ef6724 authored by Fabio Baltieri's avatar Fabio Baltieri Committed by Felipe Balbi

usb: phy: ab8500-usb: convert to devm_kzalloc

Convert local data allocation to devm_kzalloc and drop unnecessary fail
path code.
Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarFabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 3ee1f2e6
...@@ -628,15 +628,13 @@ static int ab8500_usb_probe(struct platform_device *pdev) ...@@ -628,15 +628,13 @@ static int ab8500_usb_probe(struct platform_device *pdev)
return -ENODEV; return -ENODEV;
} }
ab = kzalloc(sizeof *ab, GFP_KERNEL); ab = devm_kzalloc(&pdev->dev, sizeof(*ab), GFP_KERNEL);
if (!ab) if (!ab)
return -ENOMEM; return -ENOMEM;
otg = kzalloc(sizeof *otg, GFP_KERNEL); otg = devm_kzalloc(&pdev->dev, sizeof(*otg), GFP_KERNEL);
if (!otg) { if (!otg)
kfree(ab);
return -ENOMEM; return -ENOMEM;
}
ab->dev = &pdev->dev; ab->dev = &pdev->dev;
ab->ab8500 = ab8500; ab->ab8500 = ab8500;
...@@ -665,12 +663,12 @@ static int ab8500_usb_probe(struct platform_device *pdev) ...@@ -665,12 +663,12 @@ static int ab8500_usb_probe(struct platform_device *pdev)
err = ab8500_usb_irq_setup(pdev, ab); err = ab8500_usb_irq_setup(pdev, ab);
if (err < 0) if (err < 0)
goto fail; return err;
err = usb_add_phy(&ab->phy, USB_PHY_TYPE_USB2); err = usb_add_phy(&ab->phy, USB_PHY_TYPE_USB2);
if (err) { if (err) {
dev_err(&pdev->dev, "Can't register transceiver\n"); dev_err(&pdev->dev, "Can't register transceiver\n");
goto fail; return err;
} }
/* Needed to enable ID detection. */ /* Needed to enable ID detection. */
...@@ -679,10 +677,6 @@ static int ab8500_usb_probe(struct platform_device *pdev) ...@@ -679,10 +677,6 @@ static int ab8500_usb_probe(struct platform_device *pdev)
dev_info(&pdev->dev, "revision 0x%2x driver initialized\n", rev); dev_info(&pdev->dev, "revision 0x%2x driver initialized\n", rev);
return 0; return 0;
fail:
kfree(otg);
kfree(ab);
return err;
} }
static int ab8500_usb_remove(struct platform_device *pdev) static int ab8500_usb_remove(struct platform_device *pdev)
...@@ -700,9 +694,6 @@ 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); platform_set_drvdata(pdev, NULL);
kfree(ab->phy.otg);
kfree(ab);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment