* [PATCH next] driver core: auxiliary bus: Fix IS_ERR() vs NULL check in __devm_auxiliary_device_create()
@ 2025-04-23 8:17 Dan Carpenter
2025-04-23 9:31 ` Jerome Brunet
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2025-04-23 8:17 UTC (permalink / raw)
To: Jerome Brunet
Cc: Greg Kroah-Hartman, Dave Ertman, Ira Weiny, Leon Romanovsky,
Rafael J. Wysocki, Danilo Krummrich, linux-kernel,
kernel-janitors
The auxiliary_device_create() function returns NULL. It doesn't return
error pointers. Update the checking to match.
Fixes: eaa0d30216c1 ("driver core: auxiliary bus: add device creation helpers")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/base/auxiliary.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c
index 810b6105a75d..61b876d90b7f 100644
--- a/drivers/base/auxiliary.c
+++ b/drivers/base/auxiliary.c
@@ -491,8 +491,8 @@ struct auxiliary_device *__devm_auxiliary_device_create(struct device *dev,
int ret;
auxdev = auxiliary_device_create(dev, modname, devname, platform_data, id);
- if (IS_ERR(auxdev))
- return auxdev;
+ if (!auxdev)
+ return ERR_PTR(-ENOMEM);
ret = devm_add_action_or_reset(dev, auxiliary_device_destroy,
auxdev);
--
2.47.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH next] driver core: auxiliary bus: Fix IS_ERR() vs NULL check in __devm_auxiliary_device_create()
2025-04-23 8:17 [PATCH next] driver core: auxiliary bus: Fix IS_ERR() vs NULL check in __devm_auxiliary_device_create() Dan Carpenter
@ 2025-04-23 9:31 ` Jerome Brunet
2025-04-23 10:05 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Jerome Brunet @ 2025-04-23 9:31 UTC (permalink / raw)
To: Dan Carpenter
Cc: Greg Kroah-Hartman, Dave Ertman, Ira Weiny, Leon Romanovsky,
Rafael J. Wysocki, Danilo Krummrich, linux-kernel,
kernel-janitors
On Wed 23 Apr 2025 at 11:17, Dan Carpenter <dan.carpenter@linaro.org> wrote:
> The auxiliary_device_create() function returns NULL. It doesn't return
> error pointers. Update the checking to match.
>
> Fixes: eaa0d30216c1 ("driver core: auxiliary bus: add device creation helpers")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Thanks for catching this mistake Dan.
The thing was initially setup to return error code. Greg asked to
simply return NULL on error and I forgot to re-align the devm variant.
So I think the fix should be to check for NULL as you did but return
NULL too so it is aligned with non-devm variant.
If you wish, I can handle a v2.
> ---
> drivers/base/auxiliary.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c
> index 810b6105a75d..61b876d90b7f 100644
> --- a/drivers/base/auxiliary.c
> +++ b/drivers/base/auxiliary.c
> @@ -491,8 +491,8 @@ struct auxiliary_device *__devm_auxiliary_device_create(struct device *dev,
> int ret;
>
> auxdev = auxiliary_device_create(dev, modname, devname, platform_data, id);
> - if (IS_ERR(auxdev))
> - return auxdev;
> + if (!auxdev)
> + return ERR_PTR(-ENOMEM);
>
> ret = devm_add_action_or_reset(dev, auxiliary_device_destroy,
> auxdev);
--
Jerome
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH next] driver core: auxiliary bus: Fix IS_ERR() vs NULL check in __devm_auxiliary_device_create()
2025-04-23 9:31 ` Jerome Brunet
@ 2025-04-23 10:05 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2025-04-23 10:05 UTC (permalink / raw)
To: Jerome Brunet
Cc: Greg Kroah-Hartman, Dave Ertman, Ira Weiny, Leon Romanovsky,
Rafael J. Wysocki, Danilo Krummrich, linux-kernel,
kernel-janitors
On Wed, Apr 23, 2025 at 11:31:56AM +0200, Jerome Brunet wrote:
> On Wed 23 Apr 2025 at 11:17, Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> > The auxiliary_device_create() function returns NULL. It doesn't return
> > error pointers. Update the checking to match.
> >
> > Fixes: eaa0d30216c1 ("driver core: auxiliary bus: add device creation helpers")
> > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
>
> Thanks for catching this mistake Dan.
>
> The thing was initially setup to return error code. Greg asked to
> simply return NULL on error and I forgot to re-align the devm variant.
>
> So I think the fix should be to check for NULL as you did but return
> NULL too so it is aligned with non-devm variant.
>
> If you wish, I can handle a v2.
Of course, it's hard to resist an offer like that but I can send a v2.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-23 10:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-23 8:17 [PATCH next] driver core: auxiliary bus: Fix IS_ERR() vs NULL check in __devm_auxiliary_device_create() Dan Carpenter
2025-04-23 9:31 ` Jerome Brunet
2025-04-23 10:05 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox