mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] spi: spi-mux: Fix coverity issue, unchecked return value
@ 2025-03-15  4:59 Sergio Perez Gonzalez
  2025-03-15 10:24 ` Jonas Gorski
  0 siblings, 1 reply; 2+ messages in thread
From: Sergio Perez Gonzalez @ 2025-03-15  4:59 UTC (permalink / raw)
  To: broonie, skhan; +Cc: Sergio Perez Gonzalez, linux-spi, linux-kernel

The return value of spi_setup() is not captured within
spi_mux_select() and it is assumed to be always success.

CID: 1638374

Signed-off-by: Sergio Perez Gonzalez <sperezglz@gmail.com>
---
 drivers/spi/spi-mux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-mux.c b/drivers/spi/spi-mux.c
index c02c4204442f..0f45a88bfbe7 100644
--- a/drivers/spi/spi-mux.c
+++ b/drivers/spi/spi-mux.c
@@ -68,9 +68,9 @@ static int spi_mux_select(struct spi_device *spi)
 
 	priv->current_cs = spi_get_chipselect(spi, 0);
 
-	spi_setup(priv->spi);
+	ret = spi_setup(priv->spi);
 
-	return 0;
+	return ret;
 }
 
 static int spi_mux_setup(struct spi_device *spi)
-- 
2.43.0


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

* Re: [PATCH] spi: spi-mux: Fix coverity issue, unchecked return value
  2025-03-15  4:59 [PATCH] spi: spi-mux: Fix coverity issue, unchecked return value Sergio Perez Gonzalez
@ 2025-03-15 10:24 ` Jonas Gorski
  0 siblings, 0 replies; 2+ messages in thread
From: Jonas Gorski @ 2025-03-15 10:24 UTC (permalink / raw)
  To: Sergio Perez Gonzalez; +Cc: broonie, skhan, linux-spi, linux-kernel

Hi,

On Sat, Mar 15, 2025 at 6:01 AM Sergio Perez Gonzalez
<sperezglz@gmail.com> wrote:
>
> The return value of spi_setup() is not captured within
> spi_mux_select() and it is assumed to be always success.
>
> CID: 1638374
>
> Signed-off-by: Sergio Perez Gonzalez <sperezglz@gmail.com>
> ---
>  drivers/spi/spi-mux.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/spi/spi-mux.c b/drivers/spi/spi-mux.c
> index c02c4204442f..0f45a88bfbe7 100644
> --- a/drivers/spi/spi-mux.c
> +++ b/drivers/spi/spi-mux.c
> @@ -68,9 +68,9 @@ static int spi_mux_select(struct spi_device *spi)
>
>         priv->current_cs = spi_get_chipselect(spi, 0);
>
> -       spi_setup(priv->spi);
> +       ret = spi_setup(priv->spi);
>
> -       return 0;
> +       return ret;

Maybe just do

return spi_setup(priv->spi);

Best regards,
Jonas

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

end of thread, other threads:[~2025-03-15 10:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-15  4:59 [PATCH] spi: spi-mux: Fix coverity issue, unchecked return value Sergio Perez Gonzalez
2025-03-15 10:24 ` Jonas Gorski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®