Re: [PATCH v2] driver core: platform: document registration-failure requirement

From: Greg Kroah-Hartman
Date: Wed Dec 22 2021 - 08:00:10 EST


On Wed, Dec 22, 2021 at 11:42:13AM +0100, Johan Hovold wrote:
> Add an explicit comment to document that the reference initialised by
> platform_device_register() needs to be released by a call to
> platform_device_put() also when registration fails (cf.
> device_register()).
>
> Signed-off-by: Johan Hovold <johan@xxxxxxxxxx>
> ---
>
> Greg,
>
> I took a quick look at driver code registering non-static platform
> devices and only found four drivers getting this wrong.
>
> I've fixed up two of them and of the remaining two, one media driver is
> using devres (hurray!) and the other ignores registration failures
> completely anyway:
>
> - vpif_probe()
> - sm501_register_device()
>
> It seems to me that the right thing to do here, at least short term, is
> to add a comment clarifying this behaviour and fix up the few driver
> that got it wrong.

Looks good, thanks for this, now queued up.

greg k-h