Skip to contentSkip to conversation

pinctrl: qcom: spmi-gpio: Mark expected switch fall-through

PATCH In review Anders Roxell 2 participants 2 messages Jul 26, 2019 – Aug 5, 2019

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

PATCH 2/2 pinctrl: qcom: spmi-gpio: Mark expected switch fall-through

When fall-through warnings was enabled by default the following warnings was starting to show up:

../drivers/pinctrl/qcom/pinctrl-spmi-gpio.c: In function ‘pmic_gpio_populate’:
../drivers/pinctrl/qcom/pinctrl-spmi-gpio.c:815:20: warning: this statement may fall
through [-Wimplicit-fallthrough=]
pad->have_buffer = true;
~~~~~~~~~~~~~~~~~^~~~~~
../drivers/pinctrl/qcom/pinctrl-spmi-gpio.c:816:2: note: here
case PMIC_GPIO_SUBTYPE_GPIOC_4CH:
^~~~
../drivers/pinctrl/qcom/pinctrl-spmi-gpio.c:820:20: warning: this statement may fall
through [-Wimplicit-fallthrough=]
pad->have_buffer = true;
~~~~~~~~~~~~~~~~~^~~~~~
../drivers/pinctrl/qcom/pinctrl-spmi-gpio.c:821:2: note: here
case PMIC_GPIO_SUBTYPE_GPIOC_8CH:
^~~~

Rework so that the compiler doesn't warn about fall-through.

Fixes d93512ef0f0e ("Makefile: Globally enable fall-through warning")
---
 drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/pinctrl/qcom/pinctrl-spmi-gpio.c +2 -0
index f39da87ea185..ebf33f65c1bc 100644
@@ -813,11 +813,13 @@ static int pmic_gpio_populate(struct pmic_gpio_state *state,
 	switch (subtype) {
 	case PMIC_GPIO_SUBTYPE_GPIO_4CH:
 		pad->have_buffer = true;
+		/* Fall through */
 	case PMIC_GPIO_SUBTYPE_GPIOC_4CH:
 		pad->num_sources = 4;
 		break;
 	case PMIC_GPIO_SUBTYPE_GPIO_8CH:
 		pad->have_buffer = true;
+		/* Fall through */
 	case PMIC_GPIO_SUBTYPE_GPIOC_8CH:
 		pad->num_sources = 8;
 		break;
Signature · 1 line
2.20.1
#1 lore raw
Quoted 15 lines · Anders Roxell

When fall-through warnings was enabled by default the following warnings was starting to show up:

../drivers/pinctrl/qcom/pinctrl-spmi-gpio.c: In function ‘pmic_gpio_populate’:
../drivers/pinctrl/qcom/pinctrl-spmi-gpio.c:815:20: warning: this statement may fall
through [-Wimplicit-fallthrough=]

   pad->have_buffer = true;
   ~~~~~~~~~~~~~~~~~^~~~~~

../drivers/pinctrl/qcom/pinctrl-spmi-gpio.c:816:2: note: here
case PMIC_GPIO_SUBTYPE_GPIOC_4CH:
^~~~
../drivers/pinctrl/qcom/pinctrl-spmi-gpio.c:820:20: warning: this statement may fall
through [-Wimplicit-fallthrough=]

   pad->have_buffer = true;
   ~~~~~~~~~~~~~~~~~^~~~~~
Quoted 8 lines

../drivers/pinctrl/qcom/pinctrl-spmi-gpio.c:821:2: note: here
case PMIC_GPIO_SUBTYPE_GPIOC_8CH:
^~~~

Rework so that the compiler doesn't warn about fall-through.

Fixes d93512ef0f0e ("Makefile: Globally enable fall-through warning")

Patch applied.

Yours,
Linus Walleij