Re: [PATCH 07/33] platform: Define platform_device_put cleanup handler

From: Fenghua Yu

Date: Wed Nov 12 2025 - 15:32:45 EST




On 11/7/25 04:34, Ben Horgan wrote:
Define a cleanup helper for use with __free to destroy platform devices
automatically when the pointer goes out of scope. This is only intended to
be used in error cases and so should be used with return_ptr() or
no_free_ptr() directly to avoid the automatic destruction on success.

A first use of this is introduced in a subsequent commit.

Signed-off-by: Ben Horgan <ben.horgan@xxxxxxx>

Reviewed-by: Fenghua Yu <fenghuay@xxxxxxxxxx>
Tested-by: Fenghua Yu <fenghuay@xxxxxxxxxx>

Thanks.

-Fenghua