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

Wander Lairson Costa posted 2 patches 1 year, 9 months ago
[PATCH v4 1/2] kunit: unregister the device on error
Posted by Wander Lairson Costa 1 year, 9 months ago
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(-)

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
Re: [PATCH v4 1/2] kunit: unregister the device on error
Posted by Greg Kroah-Hartman 1 year, 9 months ago
On Fri, Apr 19, 2024 at 10:25:01AM -0300, Wander Lairson Costa 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")

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Re: [PATCH v4 1/2] kunit: unregister the device on error
Posted by Markus Elfring 1 year, 9 months ago
> > 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.
…
> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Would you ever like to distinguish hardware register errors from
item registration failures according to further improved commit messages?

Regards,
Markus
Re: [PATCH v4 1/2] kunit: unregister the device on error
Posted by Greg Kroah-Hartman 1 year, 9 months ago
On Fri, Apr 19, 2024 at 06:32:05PM +0200, Markus Elfring 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.
> …
> > Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> Would you ever like to distinguish hardware register errors from
> item registration failures according to further improved commit messages?

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