mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-06 05:06:29 +00:00
gpio-adnp: Use common error handling code in adnp_gpio_dbg_show()
Add a jump target so that a bit of exception handling can be better reused at the end of this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
5a24d4b601
commit
5ac9d2df5b
@ -192,28 +192,20 @@ static void adnp_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
|
||||
mutex_lock(&adnp->i2c_lock);
|
||||
|
||||
err = adnp_read(adnp, GPIO_DDR(adnp) + i, &ddr);
|
||||
if (err < 0) {
|
||||
mutex_unlock(&adnp->i2c_lock);
|
||||
return;
|
||||
}
|
||||
if (err < 0)
|
||||
goto unlock;
|
||||
|
||||
err = adnp_read(adnp, GPIO_PLR(adnp) + i, &plr);
|
||||
if (err < 0) {
|
||||
mutex_unlock(&adnp->i2c_lock);
|
||||
return;
|
||||
}
|
||||
if (err < 0)
|
||||
goto unlock;
|
||||
|
||||
err = adnp_read(adnp, GPIO_IER(adnp) + i, &ier);
|
||||
if (err < 0) {
|
||||
mutex_unlock(&adnp->i2c_lock);
|
||||
return;
|
||||
}
|
||||
if (err < 0)
|
||||
goto unlock;
|
||||
|
||||
err = adnp_read(adnp, GPIO_ISR(adnp) + i, &isr);
|
||||
if (err < 0) {
|
||||
mutex_unlock(&adnp->i2c_lock);
|
||||
return;
|
||||
}
|
||||
if (err < 0)
|
||||
goto unlock;
|
||||
|
||||
mutex_unlock(&adnp->i2c_lock);
|
||||
|
||||
@ -240,6 +232,11 @@ static void adnp_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
|
||||
direction, level, interrupt, pending);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
unlock:
|
||||
mutex_unlock(&adnp->i2c_lock);
|
||||
}
|
||||
|
||||
static int adnp_gpio_setup(struct adnp *adnp, unsigned int num_gpios)
|
||||
|
Loading…
Reference in New Issue
Block a user