gpio: bail out silently on NULL descriptors
commitecfb6ce5c09ce1fbfde39418123d4fc8ab4b7985
authorLinus Walleij <linus.walleij@linaro.org>
Mon, 30 May 2016 14:48:39 +0000 (30 16:48 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 24 Jun 2016 17:22:02 +0000 (24 10:22 -0700)
treeca7613ddc437a089ebcc9d2217426c447115a8ea
parent3a2ec1551c13f5a3e8a405bb92babc11c473fa7f
gpio: bail out silently on NULL descriptors

commit 54d77198fdfbc4f0fe11b4252c1d9c97d51a3264 upstream.

In fdeb8e1547cb9dd39d5d7223b33f3565cf86c28e
("gpio: reflect base and ngpio into gpio_device")
assumed that GPIO descriptors are either valid or error
pointers, but gpiod_get_[index_]optional() actually return
NULL descriptors and then all subsequent calls should just
bail out.

Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Fixes: fdeb8e1547cb ("gpio: reflect base and ngpio into gpio_device")
Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpio/gpiolib.c