Skip to content

Commit

Permalink
gpio: exar: add a check for the return value of ida_simple_get fails
Browse files Browse the repository at this point in the history
ida_simple_get may fail and return a negative error number.
The fix checks its return value; if it fails, go to err_destroy.

Cc: <stable@vger.kernel.org>
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
  • Loading branch information
Kangjie Lu authored and Bartosz Golaszewski committed Mar 22, 2019
1 parent 9e98c67 commit 7ecced0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/gpio/gpio-exar.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ static int gpio_exar_probe(struct platform_device *pdev)
mutex_init(&exar_gpio->lock);

index = ida_simple_get(&ida_index, 0, 0, GFP_KERNEL);
if (index < 0)
goto err_destroy;

sprintf(exar_gpio->name, "exar_gpio%d", index);
exar_gpio->gpio_chip.label = exar_gpio->name;
Expand Down

0 comments on commit 7ecced0

Please sign in to comment.