gpio: pca953x: Fix uninitialized pending variable
PATCH 1/1 gpio: pca953x: Fix uninitialized pending variable
When pca953x_irq_pending returns false, the pending parameter won't be set. But pca953x_irq_handler continues using this uninitialized variable as pending irqs and will cause problem.
Fix the issue by initializing pending to 0.
--- drivers/gpio/gpio-pca953x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-pca953x.c +1 -1
@@ -814,7 +814,7 @@ static irqreturn_t pca953x_irq_handler(int irq, void *devid) {struct pca953x_chip *chip = devid;struct gpio_chip *gc = &chip->gpio_chip; -DECLARE_BITMAP (pending,MAX_LINE ); + DECLARE_BITMAP(pending, MAX_LINE) = {};int level;bool ret;
Signature · 1 line
2.7.4
Quoted 4 lines · Ye Li
When
pca953x_irq_pendingreturns false, the pending parameter won't be set. Butpca953x_irq_handlercontinues using this uninitialized variable as pending irqs and will cause problem.
Fix the issue by initializing pending to 0.
Oops, seems you are right. Thanks!
Quoted 22 lines
Fixes 064c73afe738 ("gpio: pca953x: Synchronize interrupt handler properly")Signed-off-by Ye Li <[email protected]>--- drivers/gpio/gpio-pca953x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpio/gpio-pca953x.c +1
-1@@ -814,7 +814,7 @@ static irqreturn_t pca953x_irq_handler(int irq, void *devid) {struct pca953x_chip *chip = devid;struct gpio_chip *gc = &chip->gpio_chip; -DECLARE_BITMAP (pending,MAX_LINE ); + DECLARE_BITMAP(pending, MAX_LINE) = {};int level;bool ret;Signature · 1 line
2.7.4
Signature · 2 lines
With Best Regards, Andy Shevchenko
Bartosz Golaszewski
AppliedQuoted 26 lines · Ye Li
When
pca953x_irq_pendingreturns false, the pending parameter won't be set. Butpca953x_irq_handlercontinues using this uninitialized variable as pending irqs and will cause problem.
Fix the issue by initializing pending to 0.Fixes 064c73afe738 ("gpio: pca953x: Synchronize interrupt handler properly")Signed-off-by Ye Li <[email protected]>--- drivers/gpio/gpio-pca953x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpio/gpio-pca953x.c +1
-2@@ -814,7 +814,7 @@ static irqreturn_t pca953x_irq_handler(int irq, void *devid) {struct pca953x_chip *chip = devid;struct gpio_chip *gc = &chip->gpio_chip; -DECLARE_BITMAP (pending,MAX_LINE ); + DECLARE_BITMAP(pending, MAX_LINE) = {};int level;bool ret; --
Quoted 2 lines
2.7.4
Queued for fixes, thanks!
Bartosz