Re: [PATCH v2] ieee802154: atusb: fix uninit value in atusb_set_extended_addr

From: Pavel Skripkin
Date: Tue Jan 04 2022 - 12:27:35 EST


On 1/4/22 18:40, Stefan Schmidt wrote:

It compiles, but does not work on the real hardware.

[ 1.114698] usb 1-1: new full-speed USB device number 2 using uhci_hcd
[ 1.261691] usb 1-1: New USB device found, idVendor=20b7,
idProduct=1540, bcdDevice= 0.01
[ 1.263421] usb 1-1: New USB device strings: Mfr=0, Product=0,
SerialNumber=1
[ 1.264952] usb 1-1: SerialNumber: 4630333438371502231a
[ 1.278042] usb 1-1: ATUSB: AT86RF231 version 2
[ 1.281087] usb 1-1: Firmware: major: 0, minor: 3, hardware type:
ATUSB (2)
[ 1.285191] usb 1-1: atusb_control_msg: req 0x01 val 0x0 idx 0x0,
error -61
[ 1.286903] usb 1-1: failed to fetch extended address, random address set
[ 1.288757] usb 1-1: atusb_probe: initialization failed, error = -61
[ 1.290922] atusb: probe of 1-1:1.0 failed with error -61


Without your patch it works as expected:

[ 1.091925] usb 1-1: new full-speed USB device number 2 using uhci_hcd
[ 1.237743] usb 1-1: New USB device found, idVendor=20b7,
idProduct=1540, bcdDevice= 0.01
[ 1.239788] usb 1-1: New USB device strings: Mfr=0, Product=0,
SerialNumber=1
[ 1.241432] usb 1-1: SerialNumber: 4630333438371502231a
[ 1.255012] usb 1-1: ATUSB: AT86RF231 version 2
[ 1.258073] usb 1-1: Firmware: major: 0, minor: 3, hardware type:
ATUSB (2)
[ 1.262170] usb 1-1: Firmware: build #132 Mo 28. Nov 16:20:35 CET 2016
[ 1.266195] usb 1-1: Read permanent extended address
10:e2:d5:ff:ff:00:02:e8 from device


Hi Stefan,

thanks for testing on real hw.

It looks like there is corner case, that Greg mentioned in this thread. atusb_get_and_show_build() reads firmware build info, which may have various length.

Maybe we can change atusb_control_msg() to usb_control_msg() in atusb_get_and_show_build(), since other callers do not have this problem



With regards,
Pavel Skripkin