pinctrl: rockchip: Fix smatch warning
authorDavid Wu <david.wu@rock-chips.com>
Mon, 14 Nov 2016 00:28:20 +0000 (08:28 +0800)
committerDavid Wu <david.wu@rock-chips.com>
Mon, 14 Nov 2016 00:29:48 +0000 (08:29 +0800)
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 <david.wu@rock-chips.com>
drivers/pinctrl/pinctrl-rockchip.c

index e58223787ba163ebd78286e2b0e6f6f1e7fc2a05..583b450b177ac054a4187aeb6eb42e08942a1ef1 100644 (file)
@@ -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: