Skip to contentSkip to conversation

pinctrl: baytrail: fix some error handling in debugfs

PATCH In review Dan Carpenter 3 participants 3 messages Apr 27, 2016 – Apr 30, 2016

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: baytrail: fix some error handling in debugfs

We need to unlock before continuing. Also the continue was accidentally left out on one error path which would lead to a NULL dereference.

Fixes 86e3ef812fe3 ('pinctrl: baytrail: Update gpio chip operations')
drivers/pinctrl/intel/pinctrl-baytrail.c +3 -0
index 6dcf43a..55182fc 100644
@@ -1390,6 +1390,7 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
 			seq_printf(s,
 				   "Could not retrieve pin %i conf0 reg\n",
 				   pin);
+			raw_spin_unlock_irqrestore(&vg->lock, flags);
 			continue;
 		}
 		conf0 = readl(reg);
@@ -1398,6 +1399,8 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
 		if (!reg) {
 			seq_printf(s,
 				   "Could not retrieve pin %i val reg\n", pin);
+			raw_spin_unlock_irqrestore(&vg->lock, flags);
+			continue;
 		}
 		val = readl(reg);
 		raw_spin_unlock_irqrestore(&vg->lock, flags);
#2 lore raw
In reply to Dan Carpenter
Quoted 5 lines · Dan Carpenter

We need to unlock before continuing. Also the continue was accidentally left out on one error path which would lead to a NULL dereference.

Fixes 86e3ef812fe3 ('pinctrl: baytrail: Update gpio chip operations')

Patch applied with Mika's ACK.

Yours,
Linus Walleij