linux-mips
[Top] [All Lists]

[PATCH] usb: omap2430: fix memleak in err case

To: <grant.likely@linaro.org>, <rob.herring@calxeda.com>
Subject: [PATCH] usb: omap2430: fix memleak in err case
From: Libo Chen <clbchenlibo.chen@huawei.com>
Date: Wed, 15 May 2013 09:35:12 +0800
Cc: <linux-mips@linux-mips.org>, LKML <linux-kernel@vger.kernel.org>, <devicetree-discuss@lists.ozlabs.org>, Andrew Morton <akpm@linux-foundation.org>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130328 Thunderbird/17.0.5
when omap_get_control_dev fail, we should release relational platform_device

Signed-off-by: Libo Chen <libo.chen@huawei.com>
---
 drivers/usb/musb/omap2430.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 3551f1a..b626f19 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -549,7 +549,8 @@ static int omap2430_probe(struct platform_device *pdev)
                glue->control_otghs = omap_get_control_dev();
                if (IS_ERR(glue->control_otghs)) {
                        dev_vdbg(&pdev->dev, "Failed to get control device\n");
-                       return -ENODEV;
+                       ret = -ENODEV;
+                       goto err2;
                }
        } else {
                glue->control_otghs = ERR_PTR(-ENODEV);
-- 
1.7.1


<Prev in Thread] Current Thread [Next in Thread>