Re: [PATCH v1 1/2] driver core: class: Clear private pointer on registration failures

From: Daniel Lezcano
Date: Fri Jan 20 2023 - 17:43:47 EST


On 20/01/2023 20:46, Rafael J. Wysocki wrote:
From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>

Clear the class private pointer if __class_register() fails for it, so
as to allow its users to verify that the class is usable by checking
the value of that pointer.

For consistency, clear that pointer before freeing the object pointed
to by it in class_release().

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
---

Acked-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>


--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog