]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
gpio: vf610: Use PTR_ERR_OR_ZERO() in vf610_gpio_probe()
authorAndrey Smirnov <andrew.smirnov@gmail.com>
Mon, 29 Apr 2019 05:49:48 +0000 (22:49 -0700)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 28 May 2019 08:28:14 +0000 (10:28 +0200)
Simplify error checking code by replacing multiple ERR macros with a
call to PTR_ERR_OR_ZERO. No functional change intended.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Chris Healy <cphealy@gmail.com>
Cc: linux-gpio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-vf610.c

index 30aef41e3b7e64ce51629552b8244ea07680c500..7ba668db171ba5854825b4b6178a5428aeeda2d2 100644 (file)
@@ -265,7 +265,8 @@ static int vf610_gpio_probe(struct platform_device *pdev)
                return port->irq;
 
        port->clk_port = devm_clk_get(dev, "port");
-       if (!IS_ERR(port->clk_port)) {
+       ret = PTR_ERR_OR_ZERO(port->clk_port);
+       if (!ret) {
                ret = clk_prepare_enable(port->clk_port);
                if (ret)
                        return ret;
@@ -273,16 +274,17 @@ static int vf610_gpio_probe(struct platform_device *pdev)
                                               port->clk_port);
                if (ret)
                        return ret;
-       } else if (port->clk_port == ERR_PTR(-EPROBE_DEFER)) {
+       } else if (ret == -EPROBE_DEFER) {
                /*
                 * Percolate deferrals, for anything else,
                 * just live without the clocking.
                 */
-               return PTR_ERR(port->clk_port);
+               return ret;
        }
 
        port->clk_gpio = devm_clk_get(dev, "gpio");
-       if (!IS_ERR(port->clk_gpio)) {
+       ret = PTR_ERR_OR_ZERO(port->clk_gpio);
+       if (!ret) {
                ret = clk_prepare_enable(port->clk_gpio);
                if (ret)
                        return ret;
@@ -290,8 +292,8 @@ static int vf610_gpio_probe(struct platform_device *pdev)
                                               port->clk_gpio);
                if (ret)
                        return ret;
-       } else if (port->clk_gpio == ERR_PTR(-EPROBE_DEFER)) {
-               return PTR_ERR(port->clk_gpio);
+       } else if (ret == -EPROBE_DEFER) {
+               return ret;
        }
 
        gc = &port->gc;