Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cd738916 authored by Sachin Kamat's avatar Sachin Kamat Committed by Linus Walleij
Browse files

gpio-sta2x11: Fix potential NULL pointer dereference



devm_kzalloc can return NULL. Check for it before dereferencing.

Signed-off-by: default avatarSachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent ea4a21a2
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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);