Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754955Ab3EVDbp (ORCPT ); Tue, 21 May 2013 23:31:45 -0400 Received: from szxga01-in.huawei.com ([119.145.14.64]:28004 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753915Ab3EVDbn (ORCPT ); Tue, 21 May 2013 23:31:43 -0400 Message-ID: <519C3BD1.6050307@huawei.com> Date: Wed, 22 May 2013 11:30:25 +0800 From: Libo Chen User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: , , , , Li Zefan CC: , , LKML , Sergei Shtylyov Subject: [PATCH v2] usb: omap2430: fix memleak in err case References: <5192E650.3070303@huawei.com> In-Reply-To: <5192E650.3070303@huawei.com> X-Forwarded-Message-Id: <5192E650.3070303@huawei.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.135.72.158] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1108 Lines: 35 when omap_get_control_dev faild, we should release related platform_device * Changelog from v1: * fix spell: s/fail/fails/, s/relational/related/ , thank Sergei Signed-off-by: Libo Chen --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/