diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2013-06-12 08:02:45 +0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-06-17 12:26:34 +0400 |
commit | cd73891647a19f4b52f23d23f5c68175b93b56fe (patch) | |
tree | ed44cb1b9358a869454a2e3e16fc47860ddc3b9c /drivers/gpio/gpio-sta2x11.c | |
parent | ea4a21a298e1a9c4e5ea58309850477b2a19aa87 (diff) | |
download | linux-cd73891647a19f4b52f23d23f5c68175b93b56fe.tar.xz |
gpio-sta2x11: Fix potential NULL pointer dereference
devm_kzalloc can return NULL. Check for it before dereferencing.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-sta2x11.c')
-rw-r--r-- | drivers/gpio/gpio-sta2x11.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-sta2x11.c b/drivers/gpio/gpio-sta2x11.c index 558542552aae..9b5564564bcd 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); |