linux-wpan.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ieee802154/adf7242: check status of adf7242_read_reg
@ 2020-08-02 14:23 trix
  2020-08-03  6:20 ` Hennerich, Michael
  2020-08-03 18:27 ` Stefan Schmidt
  0 siblings, 2 replies; 3+ messages in thread
From: trix @ 2020-08-02 14:23 UTC (permalink / raw)
  To: michael.hennerich, alex.aring, stefan, davem, kuba, marcel
  Cc: linux-wpan, netdev, linux-kernel, Tom Rix

From: Tom Rix <trix@redhat.com>

Clang static analysis reports this error

adf7242.c:887:6: warning: Assigned value is garbage or undefined
        len = len_u8;
            ^ ~~~~~~

len_u8 is set in
       adf7242_read_reg(lp, 0, &len_u8);

When this call fails, len_u8 is not set.

So check the return code.

Fixes: 7302b9d90117 ("ieee802154/adf7242: Driver for ADF7242 MAC IEEE802154")

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/net/ieee802154/adf7242.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c
index c11f32f644db..7db9cbd0f5de 100644
--- a/drivers/net/ieee802154/adf7242.c
+++ b/drivers/net/ieee802154/adf7242.c
@@ -882,7 +882,9 @@ static int adf7242_rx(struct adf7242_local *lp)
 	int ret;
 	u8 lqi, len_u8, *data;
 
-	adf7242_read_reg(lp, 0, &len_u8);
+	ret = adf7242_read_reg(lp, 0, &len_u8);
+	if (ret)
+		return ret;
 
 	len = len_u8;
 
-- 
2.18.1


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

end of thread, other threads:[~2020-08-03 18:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-02 14:23 [PATCH] ieee802154/adf7242: check status of adf7242_read_reg trix
2020-08-03  6:20 ` Hennerich, Michael
2020-08-03 18:27 ` Stefan Schmidt

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