diff options
| -rw-r--r-- | drivers/gpio/gpiolib.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index f33063114d56..0dee0e0c247a 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
| @@ -1398,7 +1398,7 @@ static int gpiod_request(struct gpio_desc *desc, const char *label) | |||
| 1398 | int status = -EPROBE_DEFER; | 1398 | int status = -EPROBE_DEFER; |
| 1399 | unsigned long flags; | 1399 | unsigned long flags; |
| 1400 | 1400 | ||
| 1401 | if (!desc || !desc->chip) { | 1401 | if (!desc) { |
| 1402 | pr_warn("%s: invalid GPIO\n", __func__); | 1402 | pr_warn("%s: invalid GPIO\n", __func__); |
| 1403 | return -EINVAL; | 1403 | return -EINVAL; |
| 1404 | } | 1404 | } |
| @@ -1406,6 +1406,8 @@ static int gpiod_request(struct gpio_desc *desc, const char *label) | |||
| 1406 | spin_lock_irqsave(&gpio_lock, flags); | 1406 | spin_lock_irqsave(&gpio_lock, flags); |
| 1407 | 1407 | ||
| 1408 | chip = desc->chip; | 1408 | chip = desc->chip; |
| 1409 | if (chip == NULL) | ||
| 1410 | goto done; | ||
| 1409 | 1411 | ||
| 1410 | if (!try_module_get(chip->owner)) | 1412 | if (!try_module_get(chip->owner)) |
| 1411 | goto done; | 1413 | goto done; |
