Re: [PATCH] platform/chrome: fix reference leak on failed device registration

From: Guangshuo Li

Date: Thu Apr 16 2026 - 05:32:04 EST


Hi Olof,

Thanks for the review.

On Thu, 16 Apr 2026 at 05:47, Olof Johansson <olof@xxxxxxxxx> wrote:
>
>
> This looks like slop to me. It doesn't even compile (there's no local
> 'ret' variable in the function already).

You're right, I missed declaring the local ret variable in this
version, so it does not compile. Sorry for that mistake.

> This is also a no-value fix, the chromeos_ramoops structure is static
> data and not dynamically allocated. Please don't burden maintainers
> with these kinds of "fixes".
>
>
> -Olof

My reasoning was based on the implementation of
platform_device_register(): it calls device_initialize(), but if
platform_device_add() fails, platform_device_register() returns the
error directly without dropping the device reference initialized there.
Based on that, I thought the caller might need to release that
reference.

That said, I understand your point that for this statically defined
chromeos_ramoops device this is not a useful fix.

Thanks,
Guangshuo