gpio: add a check for the return value of ida_simple_get fails
PATCH 1/1 gpio: 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.
Signed-off-by Kangjie Lu <[email protected]>
--- drivers/gpio/gpio-exar.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpio/gpio-exar.c +2 -0
@@ -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;
Signature · 1 line
2.17.1
Bartosz Golaszewski
Appliedsob., 9 mar 2019 o 05:08 Kangjie Lu <[email protected]> napisał(a):
Quoted 23 lines
ida_simple_getmay fail and return a negative error number. The fix checks its return value; if it fails, go toerr_destroy.Signed-off-by Kangjie Lu <[email protected]>--- drivers/gpio/gpio-exar.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpio/gpio-exar.c +2
-1@@ -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; --
Quoted 2 lines
2.17.1
Applied, I Cc'ed stable and will send it to Linus Walleij once v5.1-rc1 is tagged.
Bart