1
0
Fork 0

ieee802154/adf7242: check status of adf7242_read_reg

[ Upstream commit e3914ed6cf ]

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: 7302b9d901 ("ieee802154/adf7242: Driver for ADF7242 MAC IEEE802154")

Signed-off-by: Tom Rix <trix@redhat.com>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Link: https://lore.kernel.org/r/20200802142339.21091-1-trix@redhat.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
5.4-rM2-2.2.x-imx-squashed
Tom Rix 2020-08-02 07:23:39 -07:00 committed by Greg Kroah-Hartman
parent 22936fa7a2
commit f77f4586bd
1 changed files with 3 additions and 1 deletions

View File

@ -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;