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

Commit 33c07b46 authored by Vladimir Zapolskiy's avatar Vladimir Zapolskiy Committed by Linus Walleij
Browse files

gpio: x-gene: fix devm_ioremap_resource() check



devm_ioremap_resource() returns IOMEM_ERR_PTR() and it never
returns NULL, fix the check to prevent access to invalid
virtual address.

Signed-off-by: default avatarVladimir Zapolskiy <vz@mleia.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent cbfb3ea7
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -93,7 +93,7 @@ static int xgene_gpio_sb_probe(struct platform_device *pdev)


	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	regs = devm_ioremap_resource(&pdev->dev, res);
	regs = devm_ioremap_resource(&pdev->dev, res);
	if (!regs)
	if (IS_ERR(regs))
		return PTR_ERR(regs);
		return PTR_ERR(regs);


	ret = bgpio_init(&priv->bgc, &pdev->dev, 4,
	ret = bgpio_init(&priv->bgc, &pdev->dev, 4,