Skip to content

Commit

Permalink
ieee802154/mrf24j40: make sure we do not override return values
Browse files Browse the repository at this point in the history
If we run into an error during rx we set the the error code in ret, but override
it afterwards. Using a different variable for the extra case avoids this
situation.

CID: 1226982, 1226983
Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com>
Cc: Alan Ott <alan@signal11.us>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Stefan Schmidt authored and Marcel Holtmann committed Jun 9, 2015
1 parent 9a4d3d4 commit e5719b6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/net/ieee802154/mrf24j40.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ static int mrf24j40_handle_rx(struct mrf24j40 *devrec)
u8 lqi = 0;
u8 val;
int ret = 0;
int ret2;
struct sk_buff *skb;

/* Turn off reception of packets off the air. This prevents the
Expand Down Expand Up @@ -569,9 +570,9 @@ static int mrf24j40_handle_rx(struct mrf24j40 *devrec)

out:
/* Turn back on reception of packets off the air. */
ret = read_short_reg(devrec, REG_BBREG1, &val);
if (ret)
return ret;
ret2 = read_short_reg(devrec, REG_BBREG1, &val);
if (ret2)
return ret2;
val &= ~0x4; /* Clear RXDECINV */
write_short_reg(devrec, REG_BBREG1, val);

Expand Down

0 comments on commit e5719b6

Please sign in to comment.