浏览代码

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 <vz@mleia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Vladimir Zapolskiy 10 年之前
父节点
当前提交
33c07b4677
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      drivers/gpio/gpio-xgene-sb.c

+ 1 - 1
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,