public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] can: mcp251xfd: return errors from mcp251xfd_register_get_dev_id
@ 2022-03-19 15:31 trix
  2022-03-19 15:53 ` Marc Kleine-Budde
  0 siblings, 1 reply; 2+ messages in thread
From: trix @ 2022-03-19 15:31 UTC (permalink / raw)
  To: mkl, mani, thomas.kopp, wg, davem, kuba, pabeni, nathan,
	ndesaulniers
  Cc: linux-can, netdev, linux-kernel, llvm, Tom Rix

From: Tom Rix <trix@redhat.com>

Clang static analysis reports this issue
mcp251xfd-core.c:1813:7: warning: The left operand
  of '&' is a garbage value
  FIELD_GET(MCP251XFD_REG_DEVID_ID_MASK, dev_id),
  ^                                      ~~~~~~

dev_id is set in a successful call to
mcp251xfd_register_get_dev_id().  Though the status
of calls made by mcp251xfd_register_get_dev_id()
are checked and handled, their status' are not
returned.  So return err.

Fixes: 55e5b97f003e ("can: mcp25xxfd: add driver for Microchip MCP25xxFD SPI CAN")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
index 325024be7b045..f9dd8fdba12bc 100644
--- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
+++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
@@ -1786,7 +1786,7 @@ mcp251xfd_register_get_dev_id(const struct mcp251xfd_priv *priv, u32 *dev_id,
  out_kfree_buf_rx:
 	kfree(buf_rx);
 
-	return 0;
+	return err;
 }
 
 #define MCP251XFD_QUIRK_ACTIVE(quirk) \
-- 
2.26.3


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

* Re: [PATCH] can: mcp251xfd: return errors from mcp251xfd_register_get_dev_id
  2022-03-19 15:31 [PATCH] can: mcp251xfd: return errors from mcp251xfd_register_get_dev_id trix
@ 2022-03-19 15:53 ` Marc Kleine-Budde
  0 siblings, 0 replies; 2+ messages in thread
From: Marc Kleine-Budde @ 2022-03-19 15:53 UTC (permalink / raw)
  To: trix
  Cc: mani, thomas.kopp, wg, davem, kuba, pabeni, nathan, ndesaulniers,
	linux-can, netdev, linux-kernel, llvm

[-- Attachment #1: Type: text/plain, Size: 1030 bytes --]

On 19.03.2022 08:31:28, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
> 
> Clang static analysis reports this issue
> mcp251xfd-core.c:1813:7: warning: The left operand
>   of '&' is a garbage value
>   FIELD_GET(MCP251XFD_REG_DEVID_ID_MASK, dev_id),
>   ^                                      ~~~~~~
> 
> dev_id is set in a successful call to
> mcp251xfd_register_get_dev_id().  Though the status
> of calls made by mcp251xfd_register_get_dev_id()
> are checked and handled, their status' are not
> returned.  So return err.
> 
> Fixes: 55e5b97f003e ("can: mcp25xxfd: add driver for Microchip MCP25xxFD SPI CAN")
> Signed-off-by: Tom Rix <trix@redhat.com>

Thanks for your patch, applied to linux-can/testing.

regards,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2022-03-19 15:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-19 15:31 [PATCH] can: mcp251xfd: return errors from mcp251xfd_register_get_dev_id trix
2022-03-19 15:53 ` Marc Kleine-Budde

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