gpio: gpiolib: Print error number if gpio hog failed
authorLaxman Dewangan <ldewangan@nvidia.com>
Fri, 11 Mar 2016 13:43:21 +0000 (19:13 +0530)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 14 Apr 2016 12:50:49 +0000 (14:50 +0200)
Print the error number of GPIO hog failed during its configurations.
This helps in identifying the failure without instrumenting the code.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib.c

index 1edc830a1b5111515e90e59fd9ee2ce7d30c96a2..59a0d8e98a0432145c15c9a07f8de92fa1cd47c1 100644 (file)
@@ -2702,15 +2702,16 @@ int gpiod_hog(struct gpio_desc *desc, const char *name,
 
        local_desc = gpiochip_request_own_desc(chip, hwnum, name);
        if (IS_ERR(local_desc)) {
-               pr_err("requesting hog GPIO %s (chip %s, offset %d) failed\n",
-                      name, chip->label, hwnum);
-               return PTR_ERR(local_desc);
+               status = PTR_ERR(local_desc);
+               pr_err("requesting hog GPIO %s (chip %s, offset %d) failed, %d\n",
+                      name, chip->label, hwnum, status);
+               return status;
        }
 
        status = gpiod_configure_flags(desc, name, dflags);
        if (status < 0) {
-               pr_err("setup of hog GPIO %s (chip %s, offset %d) failed\n",
-                      name, chip->label, hwnum);
+               pr_err("setup of hog GPIO %s (chip %s, offset %d) failed, %d\n",
+                      name, chip->label, hwnum, status);
                gpiochip_free_own_desc(desc);
                return status;
        }