Skip to content

Commit 7ecced0

Browse files
kengiterbrgl
authored andcommitted
gpio: exar: add a check for the return value of ida_simple_get fails
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>
1 parent 9e98c67 commit 7ecced0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/gpio/gpio-exar.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ static int gpio_exar_probe(struct platform_device *pdev)
148148
mutex_init(&exar_gpio->lock);
149149

150150
index = ida_simple_get(&ida_index, 0, 0, GFP_KERNEL);
151+
if (index < 0)
152+
goto err_destroy;
151153

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

0 commit comments

Comments
 (0)