Re: [PATCH] firmware_loader: fix device reference leak in firmware_upload_register()

From: Guangshuo Li

Date: Sat Apr 18 2026 - 02:31:37 EST


Hi Russ,

Thanks for reviewing.

On Sat, 18 Apr 2026 at 07:22, Russ Weight <russ.weight@xxxxxxxxx> wrote:
>
> Given that the free_fw_sysfs target is used only once and no longer
> falls through, I suggest we remove the free_fw_sysfs target
> altogether.
>
> Instead of:
> goto free_fw_sysfs;
>
> Do:
> put_device(fw_dev);
> goto exit_module_put;
>
> - Russ
>
> >
> > free_fw_upload_priv:
> > kfree(fw_upload_priv);
> > --
> > 2.43.0
> >

Good point — I agree that since free_fw_sysfs is now only used once
and no longer falls through, it makes sense to remove that label
entirely and switch the error path to put_device(fw_dev); goto
exit_module_put; directly.

I'll send v2 shortly.

Thanks,
Guangshuo