Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: "Uwe Kleine-König" <ukleinek@debian.org>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-iio <linux-iio@vger.kernel.org>,
	Yves-Alexis Perez <corsac@debian.org>
Subject: Re: [PATCH v2 2/3] iio: humidity: dht11: Emit error messages for probe failures
Date: Tue, 19 Jul 2022 09:48:58 +0100	[thread overview]
Message-ID: <20220719094858.2d1ec9d6@jic23-huawei> (raw)
In-Reply-To: <3a819437-7041-f2bd-fe92-c67b040e3e4b@debian.org>

On Mon, 18 Jul 2022 22:35:31 +0200
Uwe Kleine-König <ukleinek@debian.org> wrote:

> Hello Andy,
> 
> On 7/18/22 22:27, Andy Shevchenko wrote:
> > On Mon, Jul 18, 2022 at 9:50 PM Uwe Kleine-König <ukleinek@debian.org> wrote:  
> >>
> >> There are two exit points in the driver's probe function that fail
> >> silently. From a user perspective this is unsatisfactory because the
> >> device is unusable but there is no hint in the kernel log about the
> >> actual problem which makes it unnecessarily hard to fix the problem.
> >>
> >> Make use of dev_err_probe() to emit a problem indication which also does
> >> the right thing if requesting the gpio return -EPROBE_DEFER.  
> > 
> > ...
> >   
> >> +       ret = devm_iio_device_register(dev, iio);
> >> +       if (ret < 0)  
> > 
> > Do we really need this ' < 0' part?  
> 
> Not sure, I stumbled about that when I split the patch, too. 
> devm_iio_device_register only returns a value <= 0 and I don't expect 
> dev_err_probe to behave when the error is >= 0. So adding the check at 
> least documents the expectations. But I don't have hard feelings and 
> dropping " < 0" would be fine for me, too.

Slight preference for if (ret)

J
> 
> >> +               return dev_err_probe(dev, ret, "Failed to register iio device\n");  
> 
> Best regards
> Uwe


  reply	other threads:[~2022-07-19  8:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-18 19:42 [PATCH v2 1/3] iio: humidity: dht11: Don't warn on memory allocation failure Uwe Kleine-König
2022-07-18 19:42 ` [PATCH v2 2/3] iio: humidity: dht11: Emit error messages for probe failures Uwe Kleine-König
2022-07-18 20:27   ` Andy Shevchenko
2022-07-18 20:35     ` Uwe Kleine-König
2022-07-19  8:48       ` Jonathan Cameron [this message]
2022-07-19  9:08   ` Andy Shevchenko
2022-07-18 19:42 ` [PATCH v2 3/3] iio: humidity: dht11: Use dev_err_probe consistently Uwe Kleine-König
2022-07-18 20:29   ` Andy Shevchenko
2022-07-18 20:32     ` Andy Shevchenko
2022-07-19  8:47       ` Jonathan Cameron
2022-07-18 20:26 ` [PATCH v2 1/3] iio: humidity: dht11: Don't warn on memory allocation failure 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=20220719094858.2d1ec9d6@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=corsac@debian.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=ukleinek@debian.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