aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorJarkko Nikula <jarkko.nikula@linux.intel.com>2014-09-16 09:23:15 -0400
committerLinus Walleij <linus.walleij@linaro.org>2014-09-24 03:47:20 -0400
commit324b0398781e7afb846378dd2d8a4374faaf236b (patch)
tree4e6d55c8229c743f41efbc8c1e92906e3c732bdb /drivers/gpio
parent72f908c88cef42b4ad486c39967fa4d7fdffce18 (diff)
gpio: Fix potential NULL handler data in chained irqchip handler
There is possibility with misconfigured pins that interrupt occurs instantly after setting irq_set_chained_handler() in gpiochip_set_chained_irqchip(). Now if handler gets called before irq_set_handler_data() the handler gets NULL handler data. Fix this by moving irq_set_handler_data() call before irq_set_chained_handler() in gpiochip_set_chained_irqchip(). Cc: Stable <stable@vger.kernel.org> # 3.15+ Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpiolib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 3b54edf2befe..c68d037de656 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -413,12 +413,12 @@ void gpiochip_set_chained_irqchip(struct gpio_chip *gpiochip,
413 return; 413 return;
414 } 414 }
415 415
416 irq_set_chained_handler(parent_irq, parent_handler);
417 /* 416 /*
418 * The parent irqchip is already using the chip_data for this 417 * The parent irqchip is already using the chip_data for this
419 * irqchip, so our callbacks simply use the handler_data. 418 * irqchip, so our callbacks simply use the handler_data.
420 */ 419 */
421 irq_set_handler_data(parent_irq, gpiochip); 420 irq_set_handler_data(parent_irq, gpiochip);
421 irq_set_chained_handler(parent_irq, parent_handler);
422} 422}
423EXPORT_SYMBOL_GPL(gpiochip_set_chained_irqchip); 423EXPORT_SYMBOL_GPL(gpiochip_set_chained_irqchip);
424 424