* [PATCH v2 next] driver core: auxiliary bus: Fix IS_ERR() vs NULL mixup in __devm_auxiliary_device_create()
@ 2025-04-23 10:04 Dan Carpenter
2025-04-23 13:17 ` Jerome Brunet
2025-04-23 13:26 ` Leon Romanovsky
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2025-04-23 10:04 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
This code was originally going to use error pointers but we decided it
should return NULL instead. The error pointer code in
__devm_auxiliary_device_create() was left over from the first version.
Update it to use NULL. No callers have been merged yet, so that makes
this change simple and self contained.
Fixes: eaa0d30216c1 ("driver core: auxiliary bus: add device creation helpers")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
v2: Originally I just updated the check for auxiliary_device_create()
failure and returned ERR_PTR(-ENOMEM) but obviously the
auxiliary_device_create() and devm_auxiliary_device_create()
functions should return the same thing, NULL.
drivers/base/auxiliary.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c
index 810b6105a75d..dba7c8e13a53 100644
--- a/drivers/base/auxiliary.c
+++ b/drivers/base/auxiliary.c
@@ -491,13 +491,13 @@ 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 NULL;
ret = devm_add_action_or_reset(dev, auxiliary_device_destroy,
auxdev);
if (ret)
- return ERR_PTR(ret);
+ return NULL;
return auxdev;
}
--
2.47.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2 next] driver core: auxiliary bus: Fix IS_ERR() vs NULL mixup in __devm_auxiliary_device_create()
2025-04-23 10:04 [PATCH v2 next] driver core: auxiliary bus: Fix IS_ERR() vs NULL mixup in __devm_auxiliary_device_create() Dan Carpenter
@ 2025-04-23 13:17 ` Jerome Brunet
2025-04-23 13:26 ` Leon Romanovsky
1 sibling, 0 replies; 3+ messages in thread
From: Jerome Brunet @ 2025-04-23 13:17 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 13:04, Dan Carpenter <dan.carpenter@linaro.org> wrote:
> This code was originally going to use error pointers but we decided it
> should return NULL instead. The error pointer code in
> __devm_auxiliary_device_create() was left over from the first version.
> Update it to use NULL. No callers have been merged yet, so that makes
> this change simple and self contained.
>
> Fixes: eaa0d30216c1 ("driver core: auxiliary bus: add device creation helpers")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Thanks !
Reviewed-by: Jerome Brunet <jbrunet@baylibre.com>
> ---
> v2: Originally I just updated the check for auxiliary_device_create()
> failure and returned ERR_PTR(-ENOMEM) but obviously the
> auxiliary_device_create() and devm_auxiliary_device_create()
> functions should return the same thing, NULL.
>
> drivers/base/auxiliary.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c
> index 810b6105a75d..dba7c8e13a53 100644
> --- a/drivers/base/auxiliary.c
> +++ b/drivers/base/auxiliary.c
> @@ -491,13 +491,13 @@ 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 NULL;
>
> ret = devm_add_action_or_reset(dev, auxiliary_device_destroy,
> auxdev);
> if (ret)
> - return ERR_PTR(ret);
> + return NULL;
>
> return auxdev;
> }
--
Jerome
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v2 next] driver core: auxiliary bus: Fix IS_ERR() vs NULL mixup in __devm_auxiliary_device_create()
2025-04-23 10:04 [PATCH v2 next] driver core: auxiliary bus: Fix IS_ERR() vs NULL mixup in __devm_auxiliary_device_create() Dan Carpenter
2025-04-23 13:17 ` Jerome Brunet
@ 2025-04-23 13:26 ` Leon Romanovsky
1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2025-04-23 13:26 UTC (permalink / raw)
To: Dan Carpenter
Cc: Jerome Brunet, Greg Kroah-Hartman, Dave Ertman, Ira Weiny,
Rafael J. Wysocki, Danilo Krummrich, linux-kernel,
kernel-janitors
On Wed, Apr 23, 2025 at 01:04:26PM +0300, Dan Carpenter wrote:
> This code was originally going to use error pointers but we decided it
> should return NULL instead. The error pointer code in
> __devm_auxiliary_device_create() was left over from the first version.
> Update it to use NULL. No callers have been merged yet, so that makes
> this change simple and self contained.
>
> Fixes: eaa0d30216c1 ("driver core: auxiliary bus: add device creation helpers")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> v2: Originally I just updated the check for auxiliary_device_create()
> failure and returned ERR_PTR(-ENOMEM) but obviously the
> auxiliary_device_create() and devm_auxiliary_device_create()
> functions should return the same thing, NULL.
>
> drivers/base/auxiliary.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
Thanks,
Reviewed-by: Leon Romanovsky <leon@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-23 13:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-23 10:04 [PATCH v2 next] driver core: auxiliary bus: Fix IS_ERR() vs NULL mixup in __devm_auxiliary_device_create() Dan Carpenter
2025-04-23 13:17 ` Jerome Brunet
2025-04-23 13:26 ` Leon Romanovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox