From: David Wu Date: Mon, 14 Nov 2016 00:28:20 +0000 (+0800) Subject: pinctrl: rockchip: Fix smatch warning X-Git-Tag: firefly_0821_release~1273 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=firefly-linux-kernel-4.4.55.git;a=commitdiff_plain;h=b572f41a8f787b0b1b20555a6f91aaa1b133598f pinctrl: rockchip: Fix smatch warning This patch fix the following warning: drivers/pinctrl/pinctrl-rockchip.c:1415 rockchip_set_drive_perpin() warn: inconsistent returns 'spin_lock:&bank->slock'. Locked on: line 1377 line 1384 line 1393 Unlocked on: line 1306 line 1333 line 1342 line 1352 line 1406 line 1415 drivers/pinctrl/pinctrl-rockchip.c:1415 rockchip_set_drive_perpin() warn: inconsistent returns 'irqsave:flags'. Locked on: line 1377 line 1384 line 1393 Unlocked on: line 1306 line 1333 line 1342 line 1352 line 1406 line 1415 Change-Id: I3f97010fbc283084f06b83afcc46ab684d2a11c3 Signed-off-by: David Wu --- diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index e58223787ba1..583b450b177a 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -1373,15 +1373,19 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank, data |= (extra_value << extra_bit); /* write drive strength of N channel */ - if (regmap_update_bits(extra_regmap, extra_reg, rmask, data)) + if (regmap_update_bits(extra_regmap, extra_reg, rmask, data)) { + spin_unlock_irqrestore(&bank->slock, flags); return -EINVAL; + } - if (extra_drv_type == DRV_TYPE_EXTRA_SAME_OFFSET) + if (extra_drv_type == DRV_TYPE_EXTRA_SAME_OFFSET) { extra_bit += 2; - else if (extra_drv_type == DRV_TYPE_EXTRA_SAME_BITS) + } else if (extra_drv_type == DRV_TYPE_EXTRA_SAME_BITS) { extra_reg += 0x4; - else + } else { + spin_unlock_irqrestore(&bank->slock, flags); return -EINVAL; + } /* enable the write to the equivalent lower bits */ data = ((1 << rmask_bits) - 1) << (extra_bit + 16); @@ -1389,8 +1393,10 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank, data |= (extra_value << extra_bit); /* write drive strength of P channel */ - if (regmap_update_bits(extra_regmap, extra_reg, rmask, data)) + if (regmap_update_bits(extra_regmap, extra_reg, rmask, data)) { + spin_unlock_irqrestore(&bank->slock, flags); return -EINVAL; + } break; case DRV_TYPE_IO_DEFAULT: