public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Philipp Stanner <pstanner@redhat.com>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>
Subject: Re: [PATCH v1 1/2] devres: Switch to use dev_err_probe() for unification
Date: Thu, 29 Feb 2024 12:39:54 +0200	[thread overview]
Message-ID: <ZeBe-ubcNvtDdAG6@smile.fi.intel.com> (raw)
In-Reply-To: <e2f49a1f1877550c4ca733bbca26949836d4fef1.camel@redhat.com>

On Thu, Feb 29, 2024 at 09:52:34AM +0100, Philipp Stanner wrote:
> On Tue, 2024-02-27 at 19:58 +0200, Andy Shevchenko wrote:
> > The devm_*() APIs are supposed to be called during the ->probe()
> > stage.
> > Many drivers (especially new ones) has switched to use
> 
> has -> have

Thanks, will fix.

> > dev_err_probe()
> > for error messaging for the sake of unification. Let's do the same in
> > the devres APIs.
> 
> No objections on principle. Just one thing about the implementation:

...

> > +               ret = dev_err_probe(dev, -EINVAL, "invalid resource
> > %pR\n", res);
> > +               return IOMEM_ERR_PTR(ret);
> 
> So as I see it -EINVAL is just piped through dev_err_probe() and is
> never changed.
> Don't you think it would be better to drop variable 'ret' and just do
> return IOMEM_ERR_PTR(-EINVAL);
> as before?

dev_err_probe() requires error code as a parameter. Are you suggesting to have
a duplication?

	dev_err_probe(-EINVAL);
	return -EINVAL;

I don't think it's a good suggestion, so the answer is "No, I don't think it
would be better."

> That way it would be obvious that the error code is never changed and
> it will always return -EINVAL. Otherwise you have to look up the
> function definition of dev_err_probe().

...

> The same would apply below.

Same answer.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2024-02-29 10:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 17:58 [PATCH v1 0/2] devres: A couple of cleanups Andy Shevchenko
2024-02-27 17:58 ` [PATCH v1 1/2] devres: Switch to use dev_err_probe() for unification Andy Shevchenko
2024-02-29  8:52   ` Philipp Stanner
2024-02-29 10:39     ` Andy Shevchenko [this message]
2024-02-29 10:41       ` Andy Shevchenko
2024-02-27 17:58 ` [PATCH v1 2/2] devres: Don't use "proxy" headers Andy Shevchenko

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=ZeBe-ubcNvtDdAG6@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=pstanner@redhat.com \
    /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