public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jerome Brunet <jbrunet@baylibre.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 Dave Ertman <david.m.ertman@intel.com>,
	 Ira Weiny <ira.weiny@intel.com>,
	 Leon Romanovsky <leon@kernel.org>,
	 "Rafael J. Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	 linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH next] driver core: auxiliary bus: Fix IS_ERR() vs NULL check in __devm_auxiliary_device_create()
Date: Wed, 23 Apr 2025 11:31:56 +0200	[thread overview]
Message-ID: <1jzfg7nrzn.fsf@starbuckisacylon.baylibre.com> (raw)
In-Reply-To: <aAiiLzqVulfGDPsl@stanley.mountain> (Dan Carpenter's message of "Wed, 23 Apr 2025 11:17:51 +0300")

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

  reply	other threads:[~2025-04-23  9:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2025-04-23 10:05   ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1jzfg7nrzn.fsf@starbuckisacylon.baylibre.com \
    --to=jbrunet@baylibre.com \
    --cc=dakr@kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=david.m.ertman@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=ira.weiny@intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox