[PATCH] video: fbdev: pxafb: fix out of memory error path

From: Robert Jarzmik
Date: Sat Dec 19 2015 - 07:15:14 EST


As seen by Julia, the initial allocation memory is not checked anymore
after commit "video: fbdev: pxafb: initial devicetree conversion".
Introduce back the removed test.

Reported-by: Julia Lawall <julia.lawall@xxxxxxx>
Signed-off-by: Robert Jarzmik <robert.jarzmik@xxxxxxx>
---
drivers/video/fbdev/pxafb.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c
index 8588dd683105..54666424a720 100644
--- a/drivers/video/fbdev/pxafb.c
+++ b/drivers/video/fbdev/pxafb.c
@@ -2252,6 +2252,8 @@ static int pxafb_probe(struct platform_device *dev)
ret = -ENOMEM;
pdata = dev_get_platdata(&dev->dev);
inf = devm_kmalloc(&dev->dev, sizeof(*inf), GFP_KERNEL);
+ if (!inf)
+ goto failed;

if (pdata) {
*inf = *pdata;
--
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/