]>
Commit | Line | Data |
---|---|---|
955d73e0 GKH |
1 | From 7ecced0934e574b528a1ba6c237731e682216a74 Mon Sep 17 00:00:00 2001 |
2 | From: Kangjie Lu <kjlu@umn.edu> | |
3 | Date: Fri, 8 Mar 2019 22:07:57 -0600 | |
4 | Subject: gpio: exar: add a check for the return value of ida_simple_get fails | |
5 | ||
6 | From: Kangjie Lu <kjlu@umn.edu> | |
7 | ||
8 | commit 7ecced0934e574b528a1ba6c237731e682216a74 upstream. | |
9 | ||
10 | ida_simple_get may fail and return a negative error number. | |
11 | The fix checks its return value; if it fails, go to err_destroy. | |
12 | ||
13 | Cc: <stable@vger.kernel.org> | |
14 | Signed-off-by: Kangjie Lu <kjlu@umn.edu> | |
15 | Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> | |
16 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
17 | ||
18 | --- | |
19 | drivers/gpio/gpio-exar.c | 2 ++ | |
20 | 1 file changed, 2 insertions(+) | |
21 | ||
22 | --- a/drivers/gpio/gpio-exar.c | |
23 | +++ b/drivers/gpio/gpio-exar.c | |
24 | @@ -148,6 +148,8 @@ static int gpio_exar_probe(struct platfo | |
25 | mutex_init(&exar_gpio->lock); | |
26 | ||
27 | index = ida_simple_get(&ida_index, 0, 0, GFP_KERNEL); | |
28 | + if (index < 0) | |
29 | + goto err_destroy; | |
30 | ||
31 | sprintf(exar_gpio->name, "exar_gpio%d", index); | |
32 | exar_gpio->gpio_chip.label = exar_gpio->name; |