Skip to content

Commit

Permalink
gpio-sta2x11: Fix potential NULL pointer dereference
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sachin Kamat authored and Linus Walleij committed Jun 17, 2013
1 parent ea4a21a commit cd73891
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/gpio/gpio-sta2x11.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit cd73891

Please sign in to comment.