From: Vladimir Zapolskiy Date: Sun, 29 Mar 2015 02:37:20 +0000 (+0300) Subject: gpio: x-gene: fix devm_ioremap_resource() check X-Git-Tag: firefly_0821_release~176^2~1937^2~18 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=33c07b46774219ceaa2e6650413aa4d2cd6d6dd0;p=firefly-linux-kernel-4.4.55.git 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: Vladimir Zapolskiy Signed-off-by: Linus Walleij --- diff --git a/drivers/gpio/gpio-xgene-sb.c b/drivers/gpio/gpio-xgene-sb.c index b6a15c39293e..fb9d29a5d584 100644 --- a/drivers/gpio/gpio-xgene-sb.c +++ b/drivers/gpio/gpio-xgene-sb.c @@ -93,7 +93,7 @@ static int xgene_gpio_sb_probe(struct platform_device *pdev) res = platform_get_resource(pdev, IORESOURCE_MEM, 0); regs = devm_ioremap_resource(&pdev->dev, res); - if (!regs) + if (IS_ERR(regs)) return PTR_ERR(regs); ret = bgpio_init(&priv->bgc, &pdev->dev, 4,