From patchwork Mon May 19 07:07:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 4199971 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 25AF89F3CE for ; Mon, 19 May 2014 07:11:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 58D442025A for ; Mon, 19 May 2014 07:11:27 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B8B9020279 for ; Mon, 19 May 2014 07:11:25 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WmHgn-0007uy-MH; Mon, 19 May 2014 07:08:49 +0000 Received: from mail-by2lp0244.outbound.protection.outlook.com ([207.46.163.244] helo=na01-by2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WmHgl-0007sE-9k for linux-arm-kernel@lists.infradead.org; Mon, 19 May 2014 07:08:48 +0000 Received: from BY2PR03CA068.namprd03.prod.outlook.com (10.141.249.41) by BY2PR03MB347.namprd03.prod.outlook.com (10.141.139.16) with Microsoft SMTP Server (TLS) id 15.0.944.11; Mon, 19 May 2014 07:08:24 +0000 Received: from BN1AFFO11FD016.protection.gbl (2a01:111:f400:7c10::126) by BY2PR03CA068.outlook.office365.com (2a01:111:e400:2c5d::41) with Microsoft SMTP Server (TLS) id 15.0.944.11 via Frontend Transport; Mon, 19 May 2014 07:08:24 +0000 Received: from az84smr01.freescale.net (192.88.158.2) by BN1AFFO11FD016.mail.protection.outlook.com (10.58.52.76) with Microsoft SMTP Server (TLS) id 15.0.949.9 via Frontend Transport; Mon, 19 May 2014 07:08:24 +0000 Received: from dragon.ap.freescale.net ([10.192.185.176]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id s4J78KtW027452; Mon, 19 May 2014 00:08:21 -0700 From: Shawn Guo To: Subject: [PATCH] ARM: imx: fix error handling in ipu device registration Date: Mon, 19 May 2014 15:07:54 +0800 Message-ID: <1400483274-13680-1-git-send-email-shawn.guo@freescale.com> X-Mailer: git-send-email 1.8.3.2 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(6009001)(199002)(189002)(89996001)(69596002)(68736004)(88136002)(80022001)(93916002)(44976005)(46102001)(21056001)(84676001)(102836001)(77096999)(79102001)(81156002)(87936001)(50226001)(86362001)(92566001)(4396001)(83072002)(85852003)(99396002)(50466002)(76482001)(92726001)(47776003)(64706001)(20776003)(62966002)(36756003)(81342001)(87286001)(19580395003)(19580405001)(50986999)(74502001)(77982001)(23676002)(74662001)(83322001)(77156001)(33646001)(31966008)(6806004)(81542001); DIR:OUT; SFP:; SCL:1; SRVR:BY2PR03MB347; H:az84smr01.freescale.net; FPR:; MLV:sfv; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Forefront-PRVS: 021670B4D2 Received-SPF: Fail (: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=Shawn.Guo@freescale.com; X-OriginatorOrg: freescale.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140519_000847_343554_8F4B4944 X-CRM114-Status: UNSURE ( 7.39 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) Cc: Shawn Guo , Emil Goode , stable@vger.kernel.org, linux-arm-kernel@lists.infradead.org, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Emil Goode If we fail to allocate struct platform_device pdev we dereference it after the goto label err. This bug was found using coccinelle. Fixes: afa77ef (ARM: mx3: dynamically allocate "ipu-core" devices) Signed-off-by: Emil Goode Acked-by: Uwe Kleine-König Cc: Signed-off-by: Shawn Guo --- Arnd, Olof, Please consider to apply this fix for 3.15. Thanks. Shawn arch/arm/mach-imx/devices/platform-ipu-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-imx/devices/platform-ipu-core.c b/arch/arm/mach-imx/devices/platform-ipu-core.c index fc4dd7c..6bd7c3f 100644 --- a/arch/arm/mach-imx/devices/platform-ipu-core.c +++ b/arch/arm/mach-imx/devices/platform-ipu-core.c @@ -77,7 +77,7 @@ struct platform_device *__init imx_alloc_mx3_camera( pdev = platform_device_alloc("mx3-camera", 0); if (!pdev) - goto err; + return ERR_PTR(-ENOMEM); pdev->dev.dma_mask = kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNEL); if (!pdev->dev.dma_mask)