diff mbox series

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

Message ID 20240418210236.194190-2-wander@redhat.com
State Superseded
Headers show
Series kunit: fix minor error path mistakes | expand

Commit Message

Wander Lairson Costa April 18, 2024, 9:02 p.m. UTC
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@redhat.com>
Fixes: d03c720e03bd ("kunit: Add APIs for managing devices")
---
 lib/kunit/device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Gow April 19, 2024, 4:58 a.m. UTC | #1
On Fri, 19 Apr 2024 at 05:02, Wander Lairson Costa <wander@redhat.com> 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@redhat.com>
> Fixes: d03c720e03bd ("kunit: Add APIs for managing devices")
> ---

Nice catch!

Reviewed-by: David Gow <davidgow@google.com>

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
>
Markus Elfring April 19, 2024, 5:40 a.m. UTC | #2
> kunit_init_device() should unregister the device on bus register error,
> but mistakenly it tries to unregister the bus.

Would the following description variant be more appropriate?

   kunit_init_device() should unregister the device on bus registration error.
   But it mistakenly tries to unregister the bus.


Regards,
Markus
Greg KH April 19, 2024, 6:07 a.m. UTC | #3
On Fri, Apr 19, 2024 at 07:40:43AM +0200, Markus Elfring wrote:
> > kunit_init_device() should unregister the device on bus register error,
> > but mistakenly it tries to unregister the bus.
> 
> Would the following description variant be more appropriate?
> 
>    kunit_init_device() should unregister the device on bus registration error.
>    But it mistakenly tries to unregister the bus.

Hi,

This is the semi-friendly patch-bot of Greg Kroah-Hartman.

Markus, you seem to have sent a nonsensical or otherwise pointless
review comment to a patch submission on a Linux kernel developer mailing
list.  I strongly suggest that you not do this anymore.  Please do not
bother developers who are actively working to produce patches and
features with comments that, in the end, are a waste of time.

Patch submitter, please ignore Markus's suggestion; you do not need to
follow it at all.  The person/bot/AI that sent it is being ignored by
almost all Linux kernel maintainers for having a persistent pattern of
behavior of producing distracting and pointless commentary, and
inability to adapt to feedback.  Please feel free to also ignore emails
from them.

thanks,

greg k-h's patch email bot
diff mbox series

Patch

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;
 }