Re: [PATCH v2] usb: atm: ueagle-atm: wait for pre-firmware load in .disconnect()

From: Mauricio Faria de Oliveira

Date: Tue May 26 2026 - 13:21:42 EST


On 2026-05-26 06:24, Stanislaw Gruszka wrote:
> Hi,
>
> On Fri, May 22, 2026 at 01:45:35PM -0300, Mauricio Faria de Oliveira wrote:
[...]
>> @@ -2557,8 +2561,23 @@ static int uea_probe(struct usb_interface *intf, const struct usb_device_id *id)
>>
>> usb_reset_device(usb);
>>
>> - if (UEA_IS_PREFIRM(id))
>> - return uea_load_firmware(usb, UEA_CHIP_VERSION(id));
>> + if (UEA_IS_PREFIRM(id)) {
>> + struct completion *fw_done;
>> +
>> + /* Wait for the firmware load to be done, in .disconnect() */
>> + fw_done = kzalloc_obj(*fw_done);
>> + if (!fw_done)
>> + return -ENOMEM;
>> +
>> + init_completion(fw_done);
>> + usb_set_intfdata(intf, fw_done);
>> +
>> + ret = uea_load_firmware(intf, UEA_CHIP_VERSION(id));
>> + if (ret)
>> + complete(fw_done);
>> +
>> + return ret;
>
> If uea_probe() returns an error, .disconnect() should not be called
> so complete(fw_done) is not needed. On error path we should just do
> kfree(fw_done), right ?
>
> Otherwise, the patch looks good to me.

You're right; thanks for catching this.

Tested and fixed in v3:
https://lore.kernel.org/all/20260526-ueagle-atm_req-fw-sync-v3-1-93c01961daaf@xxxxxxxxxx/

>
> Regards
> Stanislaw
[...]

--
Mauricio