[Letux-kernel] [PATCH] gpio: add another error check for missing gpiochips

Andreas Kemnade andreas at kemnade.info
Sat Jun 4 14:19:29 CEST 2016


Signed-off-by: Andreas Kemnade <andreas at kemnade.info>
---
 drivers/gpio/gpiolib-of.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index d22dcc3..3f1b2e9 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -39,7 +39,10 @@ static int of_gpiochip_find_and_xlate(struct gpio_chip *gc, void *data)
 {
 	struct gg_data *gg_data = data;
 	int ret;
-
+	if (gc == NULL) {
+		printk("gpiolibof_match  chip is missing\n");
+		return false;
+	}
 	if ((gc->of_node != gg_data->gpiospec.np) ||
 	    (gc->of_gpio_n_cells != gg_data->gpiospec.args_count) ||
 	    (!gc->of_xlate))
-- 
2.1.4



More information about the Letux-kernel mailing list