提交 d1d70e5d 编写于 作者: E Emil Goode 提交者: 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: NEmil Goode <emilgoode@gmail.com>
Acked-by: NUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: NShawn Guo <shawn.guo@freescale.com>
Signed-off-by: NOlof Johansson <olof@lixom.net>
上级 3bc4a87c
...@@ -77,7 +77,7 @@ struct platform_device *__init imx_alloc_mx3_camera( ...@@ -77,7 +77,7 @@ struct platform_device *__init imx_alloc_mx3_camera(
pdev = platform_device_alloc("mx3-camera", 0); pdev = platform_device_alloc("mx3-camera", 0);
if (!pdev) if (!pdev)
goto err; return ERR_PTR(-ENOMEM);
pdev->dev.dma_mask = kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNEL); pdev->dev.dma_mask = kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNEL);
if (!pdev->dev.dma_mask) if (!pdev->dev.dma_mask)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册