linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: stm32: return errors from stm32_gpio_direction_output()
@ 2023-11-15 20:34 Sergey Shtylyov
  2023-11-24  9:41 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: Sergey Shtylyov @ 2023-11-15 20:34 UTC (permalink / raw)
  To: Linus Walleij, linux-gpio, Maxime Coquelin, Alexandre Torgue,
	linux-stm32
  Cc: linux-arm-kernel

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

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);
 }
 
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] pinctrl: stm32: return errors from stm32_gpio_direction_output()
  2023-11-15 20:34 [PATCH] pinctrl: stm32: return errors from stm32_gpio_direction_output() Sergey Shtylyov
@ 2023-11-24  9:41 ` Linus Walleij
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2023-11-24  9:41 UTC (permalink / raw)
  To: Sergey Shtylyov
  Cc: linux-gpio, Maxime Coquelin, Alexandre Torgue, linux-stm32,
	linux-arm-kernel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-24  9:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-15 20:34 [PATCH] pinctrl: stm32: return errors from stm32_gpio_direction_output() Sergey Shtylyov
2023-11-24  9:41 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).