Skip to contentSkip to conversation

pinctrl: stm32: return errors from stm32_gpio_direction_output()

PATCH In review Sergey Shtylyov 2 participants 2 messages Nov 15, 2023 – Nov 24, 2023

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

PATCH 1/1 pinctrl: stm32: return errors from stm32_gpio_direction_output()

In the STMicroelectronics STM32 driver, stm32_gpio_direction_output() ignores the result of pinctrl_gpio_direction_output() for no good reason. Let's propagate errors from pinctrl_gpio_direction_output() upstream...

Found by Linux Verification Center (linuxtesting.org) with the Svace static analysis tool.

---
The patch is against the 'devel' branch of Linus W.'s 'linux-pinctrl.git' repo.

 drivers/pinctrl/stm32/pinctrl-stm32.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/pinctrl/stm32/pinctrl-stm32.c +1 -2
Index: linux-pinctrl/drivers/pinctrl/stm32/pinctrl-stm32.c
===================================================================
@@ -240,9 +240,8 @@ static int stm32_gpio_direction_output(s
 	struct stm32_gpio_bank *bank = gpiochip_get_data(chip);
 
 	__stm32_gpio_set(bank, offset, value);
-	pinctrl_gpio_direction_output(chip, offset);
 
-	return 0;
+	return pinctrl_gpio_direction_output(chip, offset);
 }
 
 
#1 lore raw
Quoted 8 lines · Sergey Shtylyov

In the STMicroelectronics STM32 driver, stm32_gpio_direction_output() ignores the result of pinctrl_gpio_direction_output() for no good reason. Let's propagate errors from pinctrl_gpio_direction_output() upstream...

Found by Linux Verification Center (linuxtesting.org) with the Svace static analysis tool.

Patch applied!

Yours,
Linus Walleij