Skip to contentSkip to conversation

can: mcp251xfd: return errors from mcp251xfd_register_get_dev_id

PATCH In review [email protected] 2 participants 2 messages Mar 19, 2022

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

PATCH 1/1 can: mcp251xfd: return errors from mcp251xfd_register_get_dev_id

From: Tom Rix <[email protected]>

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")
---
 drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c +1 -1
index 325024be7b045..f9dd8fdba12bc 100644
@@ -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) \
Signature · 1 line
2.26.3
#1 lore raw
Quoted 8 lines · On 19.03.2022 08:31:28, [email protected] wrote:

From: Tom Rix <[email protected]>

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),
^ ~~~~~~

Quoted 8 lines

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

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

regards,
Marc

Signature · 4 lines
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 |