Skip to content

Commit 2fd2b55

Browse files
Stefan Schmidtholtmann
authored andcommitted
ieee802154: atusb: make sure we set a randaom extended address if fetching fails
In the unlikely case were the firmware is new enough but the actual USB command still fails make sure we set a random address and return. Signed-off-by: Stefan Schmidt <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent 05a974e commit 2fd2b55

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/net/ieee802154/atusb.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -737,8 +737,11 @@ static int atusb_set_extended_addr(struct atusb *atusb)
737737
ret = atusb_control_msg(atusb, usb_rcvctrlpipe(usb_dev, 0),
738738
ATUSB_EUI64_READ, ATUSB_REQ_FROM_DEV, 0, 0,
739739
buffer, IEEE802154_EXTENDED_ADDR_LEN, 1000);
740-
if (ret < 0)
741-
dev_err(&usb_dev->dev, "failed to fetch extended address\n");
740+
if (ret < 0) {
741+
dev_err(&usb_dev->dev, "failed to fetch extended address, random address set\n");
742+
ieee802154_random_extended_addr(&atusb->hw->phy->perm_extended_addr);
743+
return ret;
744+
}
742745

743746
memcpy(&extended_addr, buffer, IEEE802154_EXTENDED_ADDR_LEN);
744747
/* Check if read address is not empty and the unicast bit is set correctly */

0 commit comments

Comments
 (0)