diff mbox series

pinctrl: stm32: return errors from stm32_gpio_direction_output()

Message ID 5ce023a8-db0c-13a9-be42-09e3348ca44d@omp.ru
State Accepted
Commit 5a002bf206508169dd9d8c002d6326e51f53b42c
Headers show
Series pinctrl: stm32: return errors from stm32_gpio_direction_output() | expand

Commit Message

Sergey Shtylyov Nov. 15, 2023, 8:34 p.m. UTC
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.

Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

---
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(-)

Comments

Linus Walleij Nov. 24, 2023, 9:41 a.m. UTC | #1
On Wed, Nov 15, 2023 at 9:34 PM Sergey Shtylyov <s.shtylyov@omp.ru> wrote:

> 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.
>
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

Patch applied!

Yours,
Linus Walleij
diff mbox series

Patch

Index: linux-pinctrl/drivers/pinctrl/stm32/pinctrl-stm32.c
===================================================================
--- linux-pinctrl.orig/drivers/pinctrl/stm32/pinctrl-stm32.c
+++ 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);
 }