Re: [PATCH v3 1/2] kunit: unregister the device on error

From: David Gow
Date: Fri Apr 19 2024 - 00:59:03 EST


On Fri, 19 Apr 2024 at 05:02, Wander Lairson Costa <wander@xxxxxxxxxx> wrote:
>
> kunit_init_device() should unregister the device on bus register error,
> but mistakenly it tries to unregister the bus.
>
> Unregister the device instead of the bus.
>
> Signed-off-by: Wander Lairson Costa <wander@xxxxxxxxxx>
> Fixes: d03c720e03bd ("kunit: Add APIs for managing devices")
> ---

Nice catch!

Reviewed-by: David Gow <davidgow@xxxxxxxxxx>

Cheers,
-- David


> lib/kunit/device.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/kunit/device.c b/lib/kunit/device.c
> index abc603730b8e..25c81ed465fb 100644
> --- a/lib/kunit/device.c
> +++ b/lib/kunit/device.c
> @@ -51,7 +51,7 @@ int kunit_bus_init(void)
>
> error = bus_register(&kunit_bus_type);
> if (error)
> - bus_unregister(&kunit_bus_type);
> + root_device_unregister(kunit_bus_device);
> return error;
> }
>
> --
> 2.44.0
>

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature