aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2018-01-16 02:29:50 -0500
committerLinus Walleij <linus.walleij@linaro.org>2018-01-17 01:44:14 -0500
commit7d18f0a14aa6a0d6bad39111c1fb655f07f71d59 (patch)
tree7d4fc71545930bed638ee6d1d84b9d9c662087be
parentb888fb6f2a278442933e3bfab70262e9a5365fb3 (diff)
gpio: No NULL owner
Sometimes a GPIO is fetched with NULL as parent device, and that is just fine. So under these circumstances, avoid using dev_name() to provide a name for the GPIO line. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/gpio/gpiolib.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index bf083bc58d30..4092b8601c4e 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -3623,6 +3623,8 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
3623 struct gpio_desc *desc = NULL; 3623 struct gpio_desc *desc = NULL;
3624 int status; 3624 int status;
3625 enum gpio_lookup_flags lookupflags = 0; 3625 enum gpio_lookup_flags lookupflags = 0;
3626 /* Maybe we have a device name, maybe not */
3627 const char *devname = dev ? dev_name(dev) : "?";
3626 3628
3627 dev_dbg(dev, "GPIO lookup for consumer %s\n", con_id); 3629 dev_dbg(dev, "GPIO lookup for consumer %s\n", con_id);
3628 3630
@@ -3651,8 +3653,11 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
3651 return desc; 3653 return desc;
3652 } 3654 }
3653 3655
3654 /* If a connection label was passed use that, else use the device name as label */ 3656 /*
3655 status = gpiod_request(desc, con_id ? con_id : dev_name(dev)); 3657 * If a connection label was passed use that, else attempt to use
3658 * the device name as label
3659 */
3660 status = gpiod_request(desc, con_id ? con_id : devname);
3656 if (status < 0) 3661 if (status < 0)
3657 return ERR_PTR(status); 3662 return ERR_PTR(status);
3658 3663