diff options
author | Fabio Baltieri <fabio.baltieri@linaro.org> | 2013-04-03 04:45:03 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-04-03 04:55:48 -0400 |
commit | 81ef6724302e0c7ba3f087403de24760601b1839 (patch) | |
tree | e1e8904f1db20a1b951e4d4409377196f8bc8470 /drivers/usb/phy | |
parent | 3ee1f2e6e51581d5cb9c312161a9a9b2f18f25bf (diff) |
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>
Diffstat (limited to 'drivers/usb/phy')
-rw-r--r-- | drivers/usb/phy/phy-ab8500-usb.c | 19 |
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) | |||
628 | return -ENODEV; | 628 | return -ENODEV; |
629 | } | 629 | } |
630 | 630 | ||
631 | ab = kzalloc(sizeof *ab, GFP_KERNEL); | 631 | ab = devm_kzalloc(&pdev->dev, sizeof(*ab), GFP_KERNEL); |
632 | if (!ab) | 632 | if (!ab) |
633 | return -ENOMEM; | 633 | return -ENOMEM; |
634 | 634 | ||
635 | otg = kzalloc(sizeof *otg, GFP_KERNEL); | 635 | otg = devm_kzalloc(&pdev->dev, sizeof(*otg), GFP_KERNEL); |
636 | if (!otg) { | 636 | if (!otg) |
637 | kfree(ab); | ||
638 | return -ENOMEM; | 637 | return -ENOMEM; |
639 | } | ||
640 | 638 | ||
641 | ab->dev = &pdev->dev; | 639 | ab->dev = &pdev->dev; |
642 | ab->ab8500 = ab8500; | 640 | ab->ab8500 = ab8500; |
@@ -665,12 +663,12 @@ static int ab8500_usb_probe(struct platform_device *pdev) | |||
665 | 663 | ||
666 | err = ab8500_usb_irq_setup(pdev, ab); | 664 | err = ab8500_usb_irq_setup(pdev, ab); |
667 | if (err < 0) | 665 | if (err < 0) |
668 | goto fail; | 666 | return err; |
669 | 667 | ||
670 | err = usb_add_phy(&ab->phy, USB_PHY_TYPE_USB2); | 668 | err = usb_add_phy(&ab->phy, USB_PHY_TYPE_USB2); |
671 | if (err) { | 669 | if (err) { |
672 | dev_err(&pdev->dev, "Can't register transceiver\n"); | 670 | dev_err(&pdev->dev, "Can't register transceiver\n"); |
673 | goto fail; | 671 | return err; |
674 | } | 672 | } |
675 | 673 | ||
676 | /* Needed to enable ID detection. */ | 674 | /* Needed to enable ID detection. */ |
@@ -679,10 +677,6 @@ static int ab8500_usb_probe(struct platform_device *pdev) | |||
679 | dev_info(&pdev->dev, "revision 0x%2x driver initialized\n", rev); | 677 | dev_info(&pdev->dev, "revision 0x%2x driver initialized\n", rev); |
680 | 678 | ||
681 | return 0; | 679 | return 0; |
682 | fail: | ||
683 | kfree(otg); | ||
684 | kfree(ab); | ||
685 | return err; | ||
686 | } | 680 | } |
687 | 681 | ||
688 | static int ab8500_usb_remove(struct platform_device *pdev) | 682 | static int ab8500_usb_remove(struct platform_device *pdev) |
@@ -700,9 +694,6 @@ static int ab8500_usb_remove(struct platform_device *pdev) | |||
700 | 694 | ||
701 | platform_set_drvdata(pdev, NULL); | 695 | platform_set_drvdata(pdev, NULL); |
702 | 696 | ||
703 | kfree(ab->phy.otg); | ||
704 | kfree(ab); | ||
705 | |||
706 | return 0; | 697 | return 0; |
707 | } | 698 | } |
708 | 699 | ||