Commit d1d70e5d authored by Emil Goode's avatar Emil Goode Committed by Olof Johansson

ARM: imx: fix error handling in ipu device registration

If we fail to allocate struct platform_device pdev we
dereference it after the goto label err.

This bug was found using coccinelle.

Fixes: afa77ef3 (ARM: mx3: dynamically allocate "ipu-core" devices)
Signed-off-by: default avatarEmil Goode <emilgoode@gmail.com>
Acked-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarShawn Guo <shawn.guo@freescale.com>
Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
parent 3bc4a87c
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment