public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: "Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Hans de Goede" <hdegoede@redhat.com>,
	linux-kernel@vger.kernel.org,
	platform-driver-x86@vger.kernel.org,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Daniel Scally" <djrscally@gmail.com>
Subject: Re: [PATCH v2 1/4] driver core: Ignore 0 in dev_err_probe()
Date: Mon, 2 Sep 2024 17:58:18 +0200	[thread overview]
Message-ID: <ZtXgmi0TDfDMwnlz@hovoldconsulting.com> (raw)
In-Reply-To: <ce59c3c6-8729-469f-a0df-b6844792e324@stanley.mountain>

On Sat, Aug 31, 2024 at 11:25:54AM +0300, Dan Carpenter wrote:
> On Thu, Aug 22, 2024 at 04:05:38PM +0300, Andy Shevchenko wrote:
> > In the similar way, ignore 0 error code (AKA "success") in
> > dev_err_probe(). This helps to simplify a code such as
> > 
> >   if (ret < 0)
> >     return dev_err_probe(int3472->dev, ret, err_msg);
> > 
> >   return ret;
> > 
> > to
> > 
> >   return dev_err_probe(int3472->dev, ret, err_msg);
> > 
> > Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> This is a terrible idea because currently Smatch is able to detect about one
> bug per month where someone unintentionally passes the wrong error variable
> to dev_err_probe().
> 
> I really hate this.
> 
> NAKed-by: Dan Carpenter <dan.carpenter@linaro.org>

Regardless of any issues this may cause for tooling, I fully agree that
this is a terrible idea that will only result in unreadable code.

	return dev_err_probe(dev, ret, "registration failed\n");

Except it did not fail...

NAK

Johan

  parent reply	other threads:[~2024-09-02 15:58 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-22 13:05 [PATCH v2 0/4] platform/x86: int3472: A few cleanups Andy Shevchenko
2024-08-22 13:05 ` [PATCH v2 1/4] driver core: Ignore 0 in dev_err_probe() Andy Shevchenko
2024-08-24  3:08   ` Greg Kroah-Hartman
2024-08-28 16:58     ` Andy Shevchenko
2024-08-31  8:25   ` Dan Carpenter
2024-08-31  8:53     ` Dan Carpenter
2024-09-02 10:16       ` Andy Shevchenko
2024-09-02 11:10         ` Dan Carpenter
2024-09-02 11:38           ` Andy Shevchenko
2024-09-02 13:12             ` Dan Carpenter
2024-09-02 15:58     ` Johan Hovold [this message]
2024-09-02 16:10       ` Andy Shevchenko
2024-08-22 13:05 ` [PATCH v2 2/4] platform/x86: int3472: Simplify dev_err_probe() usage Andy Shevchenko
2024-08-31  8:31   ` Dan Carpenter
2024-09-02 10:17     ` Andy Shevchenko
2024-09-02 11:23       ` Dan Carpenter
2024-09-02 11:32         ` Hans de Goede
2024-08-22 13:05 ` [PATCH v2 3/4] platform/x86: int3472: Use GPIO_LOOKUP() macro Andy Shevchenko
2024-08-22 13:05 ` [PATCH v2 4/4] platform/x86: int3472: Use str_high_low() Andy Shevchenko
2024-09-02 10:19 ` [PATCH v2 0/4] platform/x86: int3472: A few cleanups Andy Shevchenko
2024-09-04 13:05   ` Hans de Goede

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=ZtXgmi0TDfDMwnlz@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dan.carpenter@linaro.org \
    --cc=djrscally@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@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