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

Commit 8d8ee18c authored by Axel Lin's avatar Axel Lin Committed by Linus Walleij
Browse files

gpio: xgene: Prevent NULL pointer dereference



platform_get_resource() can return NULL, thus add NULL test to prevent NULL
pointer dereference.

Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent fd975a7b
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -173,6 +173,11 @@ static int xgene_gpio_probe(struct platform_device *pdev)
	}
	}


	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	if (!res) {
		err = -EINVAL;
		goto err;
	}

	gpio->base = devm_ioremap_nocache(&pdev->dev, res->start,
	gpio->base = devm_ioremap_nocache(&pdev->dev, res->start,
							resource_size(res));
							resource_size(res));
	if (!gpio->base) {
	if (!gpio->base) {