pinctrl: nomadik: fix incorrect type in return expression
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Fri, 4 Aug 2017 04:49:47 +0000 (13:49 +0900)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 14 Aug 2017 13:01:59 +0000 (15:01 +0200)
Sparse reports "warning: incorrect type in return expression (different
address spaces)" because nmk_gpio_populate_chip() is supposed to return
(struct nmk_gpio_chip *) whereas devm_ioremap_resource() returns
(void __iomem *).  ERR_CAST() is needed to fix the warning.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/nomadik/pinctrl-nomadik.c

index d318ca0554894930fc205c75040dc7b826167515..a53f1a9b1ed21f2599b9531cef403a44fb85f7af 100644 (file)
@@ -1078,7 +1078,7 @@ static struct nmk_gpio_chip *nmk_gpio_populate_chip(struct device_node *np,
        res = platform_get_resource(gpio_pdev, IORESOURCE_MEM, 0);
        base = devm_ioremap_resource(&pdev->dev, res);
        if (IS_ERR(base))
-               return base;
+               return ERR_CAST(base);
        nmk_chip->addr = base;
 
        clk = clk_get(&gpio_pdev->dev, NULL);