From: Sachin Kamat Date: Wed, 12 Jun 2013 04:02:45 +0000 (+0530) Subject: gpio-sta2x11: Fix potential NULL pointer dereference X-Git-Tag: v3.12-rc1~512^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cd73891647a19f4b52f23d23f5c68175b93b56fe;p=kernel%2Fkernel-generic.git gpio-sta2x11: Fix potential NULL pointer dereference devm_kzalloc can return NULL. Check for it before dereferencing. Signed-off-by: Sachin Kamat Signed-off-by: Linus Walleij --- diff --git a/drivers/gpio/gpio-sta2x11.c b/drivers/gpio/gpio-sta2x11.c index 5585425..9b55645 100644 --- a/drivers/gpio/gpio-sta2x11.c +++ b/drivers/gpio/gpio-sta2x11.c @@ -371,6 +371,8 @@ static int gsta_probe(struct platform_device *dev) res = platform_get_resource(dev, IORESOURCE_MEM, 0); chip = devm_kzalloc(&dev->dev, sizeof(*chip), GFP_KERNEL); + if (!chip) + return -ENOMEM; chip->dev = &dev->dev; chip->reg_base = devm_request_and_ioremap(&dev->dev, res);