2024-04-18 21:07:50

by Wander Lairson Costa

[permalink] [raw]
Subject: [PATCH v3 1/2] kunit: unregister the device on error

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 <[email protected]>
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



2024-04-19 04:59:04

by David Gow

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

On Fri, 19 Apr 2024 at 05:02, Wander Lairson Costa <[email protected]> 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 <[email protected]>
> Fixes: d03c720e03bd ("kunit: Add APIs for managing devices")
> ---

Nice catch!

Reviewed-by: David Gow <[email protected]>

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
>


Attachments:
smime.p7s (3.92 kB)
S/MIME Cryptographic Signature

2024-04-19 05:41:38

by Markus Elfring

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

> 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

2024-04-19 06:07:31

by Greg Kroah-Hartman

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

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