From: Samuel O. <sam...@no...> - 2006-04-14 10:29:45
|
Hi David, In the STIR421x case, when the firmware upload fails, we need to unregister_netdev. Otherwise we hit a BUG on free_netdev(), if sysfs is enabled. Signed-off-by: Samuel Ortiz <sam...@no...> diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c index 606243d..96bdb73 100644 --- a/drivers/net/irda/irda-usb.c +++ b/drivers/net/irda/irda-usb.c @@ -1815,14 +1815,14 @@ static int irda_usb_probe(struct usb_int self->needspatch = (ret < 0); if (ret < 0) { printk("patch_device failed\n"); - goto err_out_4; + goto err_out_5; } /* replace IrDA class descriptor with what patched device is now reporting */ irda_desc = irda_usb_find_class_desc (self->usbintf); if (irda_desc == NULL) { ret = -ENODEV; - goto err_out_4; + goto err_out_5; } if (self->irda_desc) kfree (self->irda_desc); @@ -1832,6 +1832,8 @@ static int irda_usb_probe(struct usb_int return 0; +err_out_5: + unregister_netdev(self->netdev); err_out_4: kfree(self->speed_buff); err_out_3: |
From: Nick F. <nfe...@at...> - 2006-04-14 14:19:43
|
=C2 =F1=EE=EE=E1=F9=E5=ED=E8=E8 =EE=F2 Friday 14 April 2006 13:16 Samuel Or= tiz =ED=E0=EF=E8=F1=E0=EB(a): > In the STIR421x case, when the firmware upload fails, we need to > unregister_netdev. Otherwise we hit a BUG on free_netdev(), if sysfs is > enabled. Ok, I appled the patch to irda-usb.c, and rollback firmware filenames array= to=20 load invalid firmware first. Really no more craches! The kernel log below. Apr 14 14:09:35 titan kernel: usb 1-6: new high speed USB device using=20 ehci_hcd and address 2 Apr 14 14:09:35 titan kernel: usb 1-6: configuration #1 chosen from 1 choice Apr 14 14:09:36 titan kernel: irda_init() Apr 14 14:09:37 titan kernel: NET: Registered protocol family 23 Apr 14 14:09:37 titan kernel: IRDA-USB found at address 2, Vendor: 66f,=20 Product: 4210 Apr 14 14:09:37 titan kernel: irda_usb_parse_endpoints(), And our endpoints= =20 are : in=3D02, out=3D01 (512), int=3D00 Apr 14 14:09:37 titan kernel: Assertion failed!=20 drivers/net/irda/irda-usb.c:irda_usb_parse_endpoints:1575 self =2D>bulk_out_mtu =3D=3D 64 Apr 14 14:09:37 titan kernel: irda_usb_init_qos(), dongle says speed=3D0x37= =46,=20 size=3D0x20, window=3D0x8, bofs=3D0x80, turn=3D0x4 Apr 14 14:09:37 titan kernel: IrDA: Registered device irda0 Apr 14 14:09:37 titan kernel: stir421x_patching(): Request 0 to firmware na= me=20 42101001.sb Apr 14 14:09:37 titan kernel: stir421x_patching(): Received firmware=20 42101001.sb (8299 bytes), ret=3D0 Apr 14 14:09:37 titan kernel: stir421x_getfwver(): Firmware version 1.0.1=20 found! Apr 14 14:09:37 titan kernel: stir421x_patching(): Invalid firmware=20 42101001.sb version Apr 14 14:09:37 titan kernel: stir421x_patching(): Request 1 to firmware na= me=20 42101002.sb Apr 14 14:09:37 titan kernel: stir421x_patching(): Received firmware=20 42101002.sb (8299 bytes), ret=3D0 Apr 14 14:09:37 titan kernel: stir421x_getfwver(): Firmware version 1.0.1=20 found! Apr 14 14:09:37 titan kernel: stir421x_patching(): Invalid firmware=20 42101002.sb version Apr 14 14:09:37 titan kernel: irda-usb: probe of 1-6:1.0 failed with error = =2D22 Apr 14 14:09:37 titan kernel: usbcore: registered new driver irda-usb |
From: Nick F. <nfe...@at...> - 2006-04-14 14:52:37
|
Samuel, may be will be better to change a method of firmware upload? First to check self->usbdev->descriptor.bcdDevice, than convert from decimal to hex-viewed string, and add the string to firmware name? That because if I upload valid firmware as first file, than upload is correct, otherwise it doesn't loaded, and I have no idea... The code fragment below showed my gabby modification of stir421x_patching() function ... for (i = 0; i < ARRAY_SIZE(stir421x_patches); i++) { IRDA_WARNING("%s(): Request %d to firmware %s\n", __FUNCTION__, i, stir421x_patches[i]); // fw = NULL; // Hmm... Not sure than its effective ret = request_firmware(&fw, stir421x_patches[i], &self->usbdev->dev); mdelay(FIRMWARE_IO_DELAY); IRDA_WARNING("%s(): Firmware request ret=%d\n", __FUNCTION__, ret); if (ret < 0) continue; // See the _request_firmware() internals /* We get a patch from userspace */ IRDA_WARNING("%s(): Received firmware %s (%u bytes)\n", __FUNCTION__, stir421x_patches[i], fw->size); mdelay(FIRMWARE_IO_DELAY); ret = stir421x_getfwver(fw->data, fw->size); mdelay(FIRMWARE_IO_DELAY); IRDA_WARNING("%s(): Firmware version=%d bcdDevice=%d\n", __FUNCTION__, ret, self->usbdev->descriptor.bcdDevice); mdelay(FIRMWARE_IO_DELAY); /* if ((ret < 0) || (ret != self->usbdev->descriptor.bcdDevice)) */ if (ret != self->usbdev->descriptor.bcdDevice) { /* Couldn't fetch a version, let's move on to the next file */ ret = -EINVAL; IRDA_ERROR("%s(): Invalid firmware %s version, ret=%d\n", __FUNCTION__, stir421x_patches[i], ret); release_firmware(fw); mdelay(FIRMWARE_IO_DELAY); continue; } /* If we're here, we've found a correct patch */ ret = 0; break; } IRDA_WARNING("%s(): End of firmware upload loop (return %d)\n", __FUNCTION__, ret); ... See the log - I plug in the dongle, first firmware invalid for this dongle, second is valid, but doesn't loaded Apr 14 17:34:33 titan kernel: usb 1-6: new high speed USB device using ehci_hcd and address 2 Apr 14 17:34:33 titan kernel: usb 1-6: configuration #1 chosen from 1 choice Apr 14 17:34:34 titan kernel: irda_init() Apr 14 17:34:34 titan kernel: NET: Registered protocol family 23 Apr 14 17:34:34 titan kernel: IRDA-USB found at address 2, Vendor: 66f, Product: 4210 Apr 14 17:34:34 titan kernel: irda_usb_parse_endpoints(), And our endpoints are : in=02, out=01 (512), int=00 Apr 14 17:34:34 titan kernel: Assertion failed! drivers/net/irda/irda-usb.c:irda_usb_parse_endpoints:1584 self->bulk_out_mtu == 64 Apr 14 17:34:34 titan kernel: irda_usb_init_qos(), dongle says speed=0x37F, size=0x20, window=0x8, bofs=0x80, turn=0x4 Apr 14 17:34:34 titan kernel: IrDA: Registered device irda0 ----------------------------------- Ok, here is loop begin - first turn ----------------------------------- Apr 14 17:34:34 titan kernel: stir421x_patching(): Request 0 to firmware 42101001.sb Apr 14 17:34:35 titan kernel: stir421x_patching(): Firmware request ret=0 Apr 14 17:34:35 titan kernel: stir421x_patching(): Received firmware 42101001.sb (8299 bytes) Apr 14 17:34:35 titan kernel: stir421x_getfwver(): Firmware version 1.0.1 found! Apr 14 17:34:35 titan kernel: stir421x_patching(): Firmware version=4097 bcdDevice=4098 Apr 14 17:34:35 titan kernel: stir421x_patching(): Invalid firmware 42101001.sb version, ret=-22 ----------------------------------------------- Second turn - valid firmware, but upload failed ----------------------------------------------- Apr 14 17:34:35 titan kernel: stir421x_patching(): Request 1 to firmware 42101002.sb Apr 14 17:34:35 titan kernel: stir421x_patching(): Firmware request ret=0 ----------------------------------------------- Even no message what immediately after the loop ----------------------------------------------- Apr 14 17:34:35 titan kernel: irda-usb: probe of 1-6:1.0 failed with error -22 Apr 14 17:34:35 titan kernel: usbcore: registered new driver irda-usb ------------------------ Here I unplug the dongle ------------------------ Apr 14 17:35:39 titan kernel: usb 1-6: USB disconnect, address 2 Apr 14 17:35:40 titan usb.agent[5602]: USB device /devices/pci0000:00/0000:00:1d.7/usb1/1-6 removed -------------------- And plug in it again -------------------- Apr 14 17:35:46 titan kernel: usb 1-6: new high speed USB device using ehci_hcd and address 3 Apr 14 17:35:46 titan kernel: usb 1-6: configuration #1 chosen from 1 choice Apr 14 17:35:46 titan kernel: printk: 9 messages suppressed. Apr 14 17:35:46 titan kernel: IRDA-USB found at address 3, Vendor: 66f, Product: 4210 Apr 14 17:35:46 titan kernel: irda_usb_parse_endpoints(), And our endpoints are : in=02, out=01 (512), int=00 Apr 14 17:35:46 titan kernel: Assertion failed! drivers/net/irda/irda-usb.c:irda_usb_parse_endpoints:1584 self->bulk_out_mtu == 64 Apr 14 17:35:46 titan kernel: irda_usb_init_qos(), dongle says speed=0x37F, size=0x20, window=0x8, bofs=0x80, turn=0x4 Apr 14 17:35:46 titan kernel: IrDA: Registered device irda0 Apr 14 17:35:46 titan kernel: stir421x_patching(): Request 0 to firmware 42101001.sb Apr 14 17:35:47 titan kernel: stir421x_patching(): Firmware request ret=0 Apr 14 17:35:47 titan kernel: stir421x_patching(): Received firmware 42101001.sb (8299 bytes) Apr 14 17:35:47 titan kernel: stir421x_getfwver(): Firmware version 1.0.1 found! Apr 14 17:35:47 titan kernel: stir421x_patching(): Firmware version=4097 bcdDevice=4098 Apr 14 17:35:47 titan kernel: stir421x_patching(): Invalid firmware 42101001.sb version, ret=-22 Apr 14 17:35:47 titan kernel: stir421x_patching(): Request 1 to firmware 42101002.sb Apr 14 17:35:47 titan kernel: stir421x_patching(): Firmware request ret=0 Apr 14 17:35:47 titan kernel: irda-usb: probe of 1-6:1.0 failed with error -22 Apr 14 17:35:48 titan firmware_helper[5733]: main: error loading '/lib/firmware/42101002.sb' for device '/class/firmware/1-6' with driver 'usb' ----------------------------------------------------------------- Only on second attempt I got a message from hotplug (a line above ----------------------------------------------------------------- |
From: David S. M. <da...@da...> - 2006-04-14 23:04:10
|
From: Samuel Ortiz <sam...@no...> Date: Fri, 14 Apr 2006 13:16:07 +0300 > Hi David, > > In the STIR421x case, when the firmware upload fails, we need to unregister_netdev. Otherwise we hit a BUG on free_netdev(), if sysfs is enabled. > > Signed-off-by: Samuel Ortiz <sam...@no...> Applied, but please become familiar with the carriage return key on your keyboard and format your changelog descirptions to ~80 columns. Thanks. |