All of lore.kernel.org
 help / color / mirror / Atom feed
From: Riku Voipio <riku.voipio@iki.fi>
To: Adrian Bunk <bunk@kernel.org>
Cc: "Mark M. Hoffman" <mhoffman@lightlink.com>,
	lm-sensors@lm-sensors.org, linux-kernel@vger.kernel.org
Subject: Re: [lm-sensors] hwmon/f75375s.c: buggy if()
Date: Wed, 17 Oct 2007 20:45:08 +0000	[thread overview]
Message-ID: <20071017204508.GA32110@kos.to> (raw)
In-Reply-To: <20071017195439.GD3778@stusta.de>

> <--  snip  -->
> 
> ...
> static ssize_t set_pwm_mode(struct device *dev, struct device_attribute *attr,
>                 const char *buf, size_t count)
> {
> ...
>         if (val != 0 || val != 1 || data->kind = f75373)
>                 return -EINVAL;
> ...
> 
> <--  snip  -->

> I'm not sure what exactly was intended, but it was for sure not intended 
> to always return -EINVAL...

Aiee. val should be 1 or 0, and kind must not be f75373.

Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
---
 drivers/hwmon/f75375s.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c
index f1df57a..885bfe9 100644
--- a/drivers/hwmon/f75375s.c
+++ b/drivers/hwmon/f75375s.c
@@ -344,7 +344,7 @@ static ssize_t set_pwm_mode(struct device *dev, struct device_attribute *attr,
    int val = simple_strtoul(buf, NULL, 10);
    u8 conf = 0;

-   if (val != 0 || val != 1 || data->kind = f75373)
+   if (!(val = 0 || val = 1 ) || data->kind = f75373)
        return -EINVAL;

    mutex_lock(&data->update_lock);
--
1.5.3.1


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

WARNING: multiple messages have this Message-ID (diff)
From: Riku Voipio <riku.voipio@iki.fi>
To: Adrian Bunk <bunk@kernel.org>
Cc: "Mark M. Hoffman" <mhoffman@lightlink.com>,
	lm-sensors@lm-sensors.org, linux-kernel@vger.kernel.org
Subject: Re: hwmon/f75375s.c: buggy if()
Date: Wed, 17 Oct 2007 23:45:08 +0300	[thread overview]
Message-ID: <20071017204508.GA32110@kos.to> (raw)
In-Reply-To: <20071017195439.GD3778@stusta.de>

> <--  snip  -->
> 
> ...
> static ssize_t set_pwm_mode(struct device *dev, struct device_attribute *attr,
>                 const char *buf, size_t count)
> {
> ...
>         if (val != 0 || val != 1 || data->kind == f75373)
>                 return -EINVAL;
> ...
> 
> <--  snip  -->

> I'm not sure what exactly was intended, but it was for sure not intended 
> to always return -EINVAL...

Aiee. val should be 1 or 0, and kind must not be f75373.

Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
---
 drivers/hwmon/f75375s.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c
index f1df57a..885bfe9 100644
--- a/drivers/hwmon/f75375s.c
+++ b/drivers/hwmon/f75375s.c
@@ -344,7 +344,7 @@ static ssize_t set_pwm_mode(struct device *dev, struct device_attribute *attr,
    int val = simple_strtoul(buf, NULL, 10);
    u8 conf = 0;

-   if (val != 0 || val != 1 || data->kind == f75373)
+   if (!(val == 0 || val == 1 ) || data->kind == f75373)
        return -EINVAL;

    mutex_lock(&data->update_lock);
--
1.5.3.1


  reply	other threads:[~2007-10-17 20:45 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-17 19:54 [lm-sensors] hwmon/f75375s.c: buggy if() Adrian Bunk
2007-10-17 19:54 ` Adrian Bunk
2007-10-17 20:45 ` Riku Voipio [this message]
2007-10-17 20:45   ` Riku Voipio
2007-10-18 13:37   ` [lm-sensors] " Mark M. Hoffman
2007-10-18 13:37     ` Mark M. Hoffman
2007-10-19 12:37     ` [lm-sensors] " Jean Delvare
2007-10-19 12:37       ` Jean Delvare
2007-10-24 11:50       ` Riku Voipio
2007-10-24 11:50         ` Riku Voipio
2007-10-25  2:25         ` Mark M. Hoffman
2007-10-25  2:25           ` Mark M. Hoffman
2007-10-25 11:48           ` Riku Voipio
2007-10-25 11:48             ` Riku Voipio
2007-10-26  8:36             ` Jean Delvare
2007-10-26  8:36               ` Jean Delvare
2007-10-26 11:14               ` Riku Voipio
2007-10-26 11:14                 ` Riku Voipio
2007-10-26 21:15                 ` Jean Delvare
2007-10-26 21:15                   ` Jean Delvare
2007-10-28 17:33                 ` Mark M. Hoffman
2007-10-28 17:33                   ` Mark M. Hoffman
2007-10-25 11:09         ` Jean Delvare
2007-10-25 11:09           ` Jean Delvare
2007-10-26 22:35 ` Riku Voipio
2007-10-31 15:19 ` Jean Delvare
2007-11-01 11:27 ` Christian Emmerich
2007-11-02 10:24 ` Jean Delvare

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=20071017204508.GA32110@kos.to \
    --to=riku.voipio@iki.fi \
    --cc=bunk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.org \
    --cc=mhoffman@lightlink.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.