diff mbox

ARM: imx: fix error handling in ipu device registration

Message ID 1400483274-13680-1-git-send-email-shawn.guo@freescale.com (mailing list archive)
State New, archived
Headers show

Commit Message

Shawn Guo May 19, 2014, 7:07 a.m. UTC
From: Emil Goode <emilgoode@gmail.com>

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 <emilgoode@gmail.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
---
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(-)

Comments

Olof Johansson May 22, 2014, 5:18 a.m. UTC | #1
On Mon, May 19, 2014 at 03:07:54PM +0800, Shawn Guo wrote:
> From: Emil Goode <emilgoode@gmail.com>
> 
> 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 <emilgoode@gmail.com>
> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
> ---
> Arnd, Olof,
> 
> Please consider to apply this fix for 3.15.  Thanks.

Applied, thanks.

BTW, it was requested to use a 12-character SHA in the Fixes: tag, since in the
future there might be a collision on the shortest one.

You can update the default for your git repo by setting the core.abbrevlength
config variable to 12.


-Olof
Shawn Guo May 22, 2014, 5:33 a.m. UTC | #2
On Wed, May 21, 2014 at 10:18:50PM -0700, Olof Johansson wrote:
> BTW, it was requested to use a 12-character SHA in the Fixes: tag, since in the
> future there might be a collision on the shortest one.
> 
> You can update the default for your git repo by setting the core.abbrevlength
> config variable to 12.

Done. Thanks for the hint, Olof.

BTW, not sure what your git version is, but with my version 1.8.3.2 the
variable seems to be core.abbrev instead of core.abbrevlength, probably
because of the change below?

http://git.kaarsemaker.net/git/commit/a71f09fe3e8b047d88b5f439c6d552e8fc7e8293/

Shawn
diff mbox

Patch

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)