Skip to contentSkip to conversation

power: supply: mark expected switch fall-throughs

PATCH In review Gustavo A. R. Silva 2 participants 2 messages Jul 17, 2018 – Jul 22, 2018

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

PATCH 1/1 power: supply: mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

Addresses-Coverity-ID: 1394724 ("Missing break in switch")
Addresses-Coverity-ID: 114958 ("Missing break in switch")

---
 drivers/power/supply/axp20x_usb_power.c   | 1 +
 drivers/power/supply/cros_usbpd-charger.c | 1 +
 drivers/power/supply/wm8350_power.c       | 3 ++-
 3 files changed, 4 insertions(+), 1 deletion(-)
drivers/power/supply/axp20x_usb_power.c +1 -0
index 44f70dc..42001df 100644
@@ -222,6 +222,7 @@ static int axp20x_usb_power_set_current_max(struct axp20x_usb_power *power,
 	case 100000:
 		if (power->axp20x_id == AXP221_ID)
 			return -EINVAL;
+		/* fall through */
 	case 500000:
 	case 900000:
 		val = (900000 - intval) / 400000;
drivers/power/supply/cros_usbpd-charger.c +1 -0
index 3a0c96f..688a16b 100644
@@ -325,6 +325,7 @@ static int cros_usbpd_charger_get_prop(struct power_supply *psy,
 		 */
 		if (ec_device->mkbp_event_supported || port->psy_online)
 			break;
+		/* fall through */
 	case POWER_SUPPLY_PROP_CURRENT_MAX:
 	case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
 	case POWER_SUPPLY_PROP_VOLTAGE_NOW:
drivers/power/supply/wm8350_power.c +2 -1
index a2740cf..15c0ca1 100644
@@ -230,7 +230,8 @@ static irqreturn_t wm8350_charger_handler(int irq, void *data)
 	case WM8350_IRQ_EXT_USB_FB:
 	case WM8350_IRQ_EXT_WALL_FB:
 		wm8350_charger_config(wm8350, policy);
-	case WM8350_IRQ_EXT_BAT_FB:   /* Fall through */
+		/* Fall through */
+	case WM8350_IRQ_EXT_BAT_FB:
 		power_supply_changed(power->battery);
 		power_supply_changed(power->usb);
 		power_supply_changed(power->ac);
Signature · 1 line
2.7.4
#1 lore raw

Hi,

Quoted 7 lines · Gustavo A. R. Silva

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

Addresses-Coverity-ID: 1394724 ("Missing break in switch")
Addresses-Coverity-ID: 114958 ("Missing break in switch")

---

Thanks, queued into power-supply's for-next branch.

-- Sebastian

Quoted 46 lines
 drivers/power/supply/axp20x_usb_power.c   | 1 +
 drivers/power/supply/cros_usbpd-charger.c | 1 +
 drivers/power/supply/wm8350_power.c       | 3 ++-
 3 files changed, 4 insertions(+), 1 deletion(-)
drivers/power/supply/axp20x_usb_power.c +1 -0
index 44f70dc..42001df 100644
@@ -222,6 +222,7 @@ static int axp20x_usb_power_set_current_max(struct axp20x_usb_power *power,
 	case 100000:
 		if (power->axp20x_id == AXP221_ID)
 			return -EINVAL;
+		/* fall through */
 	case 500000:
 	case 900000:
 		val = (900000 - intval) / 400000;
drivers/power/supply/cros_usbpd-charger.c +1 -0
index 3a0c96f..688a16b 100644
@@ -325,6 +325,7 @@ static int cros_usbpd_charger_get_prop(struct power_supply *psy,
 		 */
 		if (ec_device->mkbp_event_supported || port->psy_online)
 			break;
+		/* fall through */
 	case POWER_SUPPLY_PROP_CURRENT_MAX:
 	case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
 	case POWER_SUPPLY_PROP_VOLTAGE_NOW:
drivers/power/supply/wm8350_power.c +2 -1
index a2740cf..15c0ca1 100644
@@ -230,7 +230,8 @@ static irqreturn_t wm8350_charger_handler(int irq, void *data)
 	case WM8350_IRQ_EXT_USB_FB:
 	case WM8350_IRQ_EXT_WALL_FB:
 		wm8350_charger_config(wm8350, policy);
-	case WM8350_IRQ_EXT_BAT_FB:   /* Fall through */
+		/* Fall through */
+	case WM8350_IRQ_EXT_BAT_FB:
 		power_supply_changed(power->battery);
 		power_supply_changed(power->usb);
 		power_supply_changed(power->ac);
Signature · 1 line
2.7.4