mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-04-08 20:58:02 +07:00
gpiolib: gpio_name_to_desc: factor out !name check
Since name == NULL can't ever match, move the check out of IRQ-disabled region. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
This commit is contained in:
parent
55f17e2ae9
commit
ee203bbd63
@ -301,6 +301,9 @@ static struct gpio_desc *gpio_name_to_desc(const char * const name)
|
|||||||
struct gpio_device *gdev;
|
struct gpio_device *gdev;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
|
if (!name)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
spin_lock_irqsave(&gpio_lock, flags);
|
spin_lock_irqsave(&gpio_lock, flags);
|
||||||
|
|
||||||
list_for_each_entry(gdev, &gpio_devices, list) {
|
list_for_each_entry(gdev, &gpio_devices, list) {
|
||||||
@ -309,7 +312,7 @@ static struct gpio_desc *gpio_name_to_desc(const char * const name)
|
|||||||
for (i = 0; i != gdev->ngpio; ++i) {
|
for (i = 0; i != gdev->ngpio; ++i) {
|
||||||
struct gpio_desc *desc = &gdev->descs[i];
|
struct gpio_desc *desc = &gdev->descs[i];
|
||||||
|
|
||||||
if (!desc->name || !name)
|
if (!desc->name)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!strcmp(desc->name, name)) {
|
if (!strcmp(desc->name, name)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user