Re: [PATCH] serial: 8250_accent: fix reference leak on failed device registration
From: Guangshuo Li
Date: Thu Apr 16 2026 - 05:38:07 EST
Hi Jiri,
Thanks for the review.
On Thu, 16 Apr 2026 at 14:14, Jiri Slaby <jirislaby@xxxxxxxxxx> wrote:
>
> Hi,
>
>
> What reference exactly?
I was referring to the device reference initialized by
device_initialize() inside
platform_device_register(). My reasoning was that when
platform_device_add() fails, platform_device_register() returns the
error directly and does not drop that reference on the failure path.
>
> How did you verify you did the right change?
After my tool reported this case, I manually audited the relevant
source code and
checked the related core API definitions. However, I did miss the
special handling needed for a static device in this case.
> In particular, what does put_device() do on a static device, even
> initialized, ie. with no device::release? Try it...
Sorry, I should have considered and verified that
more carefully before sending the patch.
Thanks,
Guangshuo