diff mbox

pinctrl: baytrail: fix some error handling in debugfs

Message ID 20160427080835.GB22469@mwanda
State New
Headers show

Commit Message

Dan Carpenter April 27, 2016, 8:08 a.m. UTC
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')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Mika Westerberg April 28, 2016, 10:55 a.m. UTC | #1
On Wed, Apr 27, 2016 at 11:08:35AM +0300, Dan Carpenter wrote:
> 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')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Good catch!

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Linus Walleij April 30, 2016, 11:35 a.m. UTC | #2
On Wed, Apr 27, 2016 at 10:08 AM, Dan Carpenter
<dan.carpenter@oracle.com> wrote:

> 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')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Patch applied with Mika's ACK.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
index 6dcf43a..55182fc 100644
--- a/drivers/pinctrl/intel/pinctrl-baytrail.c
+++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
@@ -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);