gpio: No NULL owner
commit 7d18f0a14aa6a0d6bad39111c1fb655f07f71d59 upstream. 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> Cc: Daniel Rosenberg <drosen@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
81613ccd79
commit
c4f78b5732
|
@ -2117,6 +2117,8 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
|
||||||
struct gpio_desc *desc = NULL;
|
struct gpio_desc *desc = NULL;
|
||||||
int status;
|
int status;
|
||||||
enum gpio_lookup_flags lookupflags = 0;
|
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);
|
dev_dbg(dev, "GPIO lookup for consumer %s\n", con_id);
|
||||||
|
|
||||||
|
@ -2145,8 +2147,11 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
|
||||||
return desc;
|
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)
|
if (status < 0)
|
||||||
return ERR_PTR(status);
|
return ERR_PTR(status);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user