mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 16:29:59 +00:00
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>
This commit is contained in:
parent
b888fb6f2a
commit
7d18f0a14a
1 changed files with 7 additions and 2 deletions
|
@ -3623,6 +3623,8 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
|
|||
struct gpio_desc *desc = NULL;
|
||||
int status;
|
||||
enum gpio_lookup_flags lookupflags = 0;
|
||||
/* Maybe we have a device name, maybe not */
|
||||
const char *devname = dev ? dev_name(dev) : "?";
|
||||
|
||||
dev_dbg(dev, "GPIO lookup for consumer %s\n", con_id);
|
||||
|
||||
|
@ -3651,8 +3653,11 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
|
|||
return desc;
|
||||
}
|
||||
|
||||
/* If a connection label was passed use that, else use the device name as label */
|
||||
status = gpiod_request(desc, con_id ? con_id : dev_name(dev));
|
||||
/*
|
||||
* If a connection label was passed use that, else attempt to use
|
||||
* the device name as label
|
||||
*/
|
||||
status = gpiod_request(desc, con_id ? con_id : devname);
|
||||
if (status < 0)
|
||||
return ERR_PTR(status);
|
||||
|
||||
|
|
Loading…
Reference in a new issue