From: "Éric Piel" <eric.piel@tremplin-utc.net>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Christian Lamparter <chunkeey@googlemail.com>,
Matthew Garrett <mjg@redhat.com>,
LKML <linux-kernel@vger.kernel.org>,
platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH 01/10] lis3lv02d: avoid divide by zero due to unchecked
Date: Wed, 03 Aug 2011 15:21:12 +0200 [thread overview]
Message-ID: <4E394B48.8080506@tremplin-utc.net> (raw)
In-Reply-To: <20110801142946.94542ff3.akpm@linux-foundation.org>
Op 01-08-11 23:29, Andrew Morton schreef:
> On Mon, 1 Aug 2011 23:11:17 +0200
> Christian Lamparter<chunkeey@googlemail.com> wrote:
>
>> On Monday, August 01, 2011 10:29:06 PM Andrew Morton wrote:
>>> On Mon, 25 Jul 2011 17:16:23 +0200
>>> __ric Piel<eric.piel@tremplin-utc.net> wrote:
>>>
>>>> +static int lis3lv02d_get_pwron_wait(struct lis3lv02d *lis3)
>>>> +{
>>>> + int div = lis3lv02d_get_odr();
>>>> +
>>>> + if (WARN_ONCE(div == 0, "device returned spurious data"))
>>>> + return -ENXIO;
>>>> +
>>>> + /* LIS3 power on delay is quite long */
>>>> + msleep(lis3->pwron_delay / div);
>>>> + return 0;
>>>> +}
>>>
>>> The WARN_ONCE may not be very useful. The user gets worried, might
>>> report it (often to a distro, not to you!). But we won't actually *do*
>>> anything with the information?
>> The sensor is used to park the hdd in case of an "accident". However,
>> if the sensors is not working, the user should at least get a WARN
>> that something is very wrong, right?
>
> Well if we're doing this for the user's benefit (most WARNs are for developers)
> then the message should be user-useful. That one isn't, really.
>
> Can we come up with some text which is more useful to the user/operator and
> won't require him/her/it to send emails and raise bug reports?
>
> Also, the stack trace which WARN emits is not useful in this application?
Thanks Andrew for pointing out this.
Indeed, a WARN with such a message seems not the best way to explain
what's is going on. IIRC, Christian suspects the bug happens due to some
weird things that the bios does. So do you think this code looks better?
if (div == 0) {
pr_warn_once("device returned spurious data, it will not be used. "
"It might be a hardware or firmware bug. "
"Contact the driver's authors if you think it is not.");
return -ENXIO;
}
If every one likes it, I'll update the patch and send you the new version.
See you,
Éric
next prev parent reply other threads:[~2011-08-03 13:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-25 15:14 [PATCH 00/10] lis3: various fixes and enhancements Éric Piel
2011-07-25 15:16 ` [PATCH 01/10] lis3lv02d: avoid divide by zero due to unchecked Éric Piel
2011-08-01 20:29 ` Andrew Morton
2011-08-01 21:11 ` Christian Lamparter
2011-08-01 21:29 ` Andrew Morton
2011-08-03 13:21 ` Éric Piel [this message]
2011-07-25 15:17 ` [PATCH 02/10] lis3: update maintainer information Éric Piel
2011-07-25 15:18 ` [PATCH 03/10] lis3: add support for HP EliteBook 2730p Éric Piel
2011-07-25 15:19 ` [PATCH 04/10] lis3: add support for HP EliteBook 8540w Éric Piel
2011-07-25 15:19 ` [PATCH 05/10] hp_accel: Add HP ProBook 655x Éric Piel
2011-07-25 15:20 ` [PATCH 06/10] CONFIG_HP_ACCEL: Fix help text Éric Piel
2011-07-25 15:21 ` [PATCH 07/10] lis3: Free regulators if probe() fails Éric Piel
2011-07-25 15:22 ` [PATCH 08/10] lis3: Change naming to consistent Éric Piel
2011-07-25 15:23 ` [PATCH 09/10] lis3: Change exported function to use given Éric Piel
2011-07-25 15:24 ` [PATCH 10/10] lis3: Remove the references to the global variable in core driver Éric Piel
2011-08-03 13:47 ` [PATCH 10/10 v2] " Éric Piel
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=4E394B48.8080506@tremplin-utc.net \
--to=eric.piel@tremplin-utc.net \
--cc=akpm@linux-foundation.org \
--cc=chunkeey@googlemail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mjg@redhat.com \
--cc=platform-driver-x86@vger.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