Re: [PATCH v2] floppy: fix reference leak on platform_device_register() failure

Guangshuo Li
2026-04-24T03:14:32Z

Hi Jiri, Jens,

Thanks for the review and for catching this.

On Thu, 23 Apr 2026 at 19:06, Jens Axboe <axboe@kernel.dk> wrote:
>
> > The patch is likely wrong. Given the pdev is static, the struct device
> > has no ->release, so releasing it will trigger a warning. AFAIR, the
> > consensus was to fix platform_device_register() proper.
>
> Thanks for letting me know, I'll revert this change for now.
>

You are right that this fix is not appropriate for this case. Since the
platform device is static and the embedded struct device has no release
callback, calling platform_device_put() / releasing it here is wrong and
can trigger warnings.

Please disregard this patch. I will drop it and not pursue it further in
its current form.

Sorry for the noise, and thanks again for the clarification.

Best regards,
Guangshuo Li