Re: [PATCH v2 1/3] driver core: platform: remove software node on release()

Bartosz Golaszewski
2026-04-27T14:13:50Z

On Sun, Apr 26, 2026 at 6:24 AM Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
>
> Still please check sashiko review - I think some of the concerns about
> error unwinding are correct.
>

Sigh... I hate the walls of text it generates. Can we set it to
"caveman mode"? :)

The first part of the review - while valid - already has a precedence
with this function. If someone allocates the platform device with
platform_device_alloc() and assigns the address of a static structure
as its platform data, on release() we'll unconditionally call kfree()
on it. The user must not assign platform data directly but use the
dedicated platform_device_add_data() helper. We could consider
providing platform_device_add_software_node() but since there are no
users, let's cross that bridge when we get there?

For the second point: sashiko's right, we need to bump the refcount earlier.

For the third: I need to look into it deeper. I thought my second test
case from patch 3/3 checks that use-case but the review makes sense.

Bart