summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorVenu Byravarasu <vbyravarasu@nvidia.com>2012-06-01 11:15:42 +0530
committerRohan Somvanshi <rsomvanshi@nvidia.com>2012-07-05 07:44:23 -0700
commit6beca4d4049eeceda8498d6b0d9c36a9a39ae3e6 (patch)
tree20743e955e1975d388738278ad9c05128ee87971 /drivers/usb
parent4df8c74291952f18d43fb608290db0ce7cc27d42 (diff)
usb: host: tegra: code clean up
Addressed below items with this patch: 1. Using devm_kzalloc in place of kzalloc. 2. Correcting platform_get_irq return value check Change-Id: I68225fe40adbb4be98e16ee2e0a4fccefadd8626 Reviewed-on: http://git-master/r/105843 Reviewed-by: Rohan Somvanshi <rsomvanshi@nvidia.com> Tested-by: Rohan Somvanshi <rsomvanshi@nvidia.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/ehci-tegra.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 2b9cd1a9ab4b..a55c16875aa3 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -411,7 +411,8 @@ static int tegra_ehci_probe(struct platform_device *pdev)
int err = 0;
int irq;
- tegra = kzalloc(sizeof(struct tegra_ehci_hcd), GFP_KERNEL);
+ tegra = devm_kzalloc(&pdev->dev, sizeof(struct tegra_ehci_hcd),
+ GFP_KERNEL);
if (!tegra) {
dev_err(&pdev->dev, "memory alloc failed\n");
return -ENOMEM;
@@ -423,8 +424,7 @@ static int tegra_ehci_probe(struct platform_device *pdev)
dev_name(&pdev->dev));
if (!hcd) {
dev_err(&pdev->dev, "unable to create HCD\n");
- err = -ENOMEM;
- goto fail_hcd;
+ return -ENOMEM;
}
platform_set_drvdata(pdev, tegra);
@@ -445,7 +445,7 @@ static int tegra_ehci_probe(struct platform_device *pdev)
}
irq = platform_get_irq(pdev, 0);
- if (!irq) {
+ if (irq < 0) {
dev_err(&pdev->dev, "failed to get IRQ\n");
err = -ENODEV;
goto fail_irq;
@@ -504,8 +504,6 @@ fail_irq:
iounmap(hcd->regs);
fail_io:
usb_put_hcd(hcd);
-fail_hcd:
- kfree(tegra);
return err;
}
@@ -553,7 +551,6 @@ static int tegra_ehci_remove(struct platform_device *pdev)
tegra_usb_phy_power_off(tegra->phy);
tegra_usb_phy_close(tegra->phy);
iounmap(hcd->regs);
- kfree(tegra);
return 0;
}