public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Henrik Rydberg <rydberg@euromail.se>
To: Guenter Roeck <guenter.roeck@ericsson.com>
Cc: Jean Delvare <khali@linux-fr.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"lm-sensors@lm-sensors.org" <lm-sensors@lm-sensors.org>
Subject: Re: [lm-sensors] [PATCH 4/8] hwmon: applesmc: Handle new temperature format
Date: Fri, 05 Nov 2010 09:34:48 +0100	[thread overview]
Message-ID: <4CD3C1A8.5050305@euromail.se> (raw)
In-Reply-To: <20101105023525.GC28308@ericsson.com>

>>

>> diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
>> index 0207618..ec92aff 100644
>> --- a/drivers/hwmon/applesmc.c
>> +++ b/drivers/hwmon/applesmc.c
>> @@ -733,13 +733,19 @@ static ssize_t applesmc_show_temperature(struct device *dev,
>>  	ret = applesmc_get_entry_by_index(index, &entry);
>>  	if (ret)
>>  		return ret;
>> +	if (entry.len > 2)
>> +		return -EINVAL;
>>  
>> -	ret = applesmc_read_entry(&entry, buffer, 2);
>> +	ret = applesmc_read_entry(&entry, buffer, entry.len);
>>  	if (ret)
>>  		return ret;
>>  
>> -	temp = buffer[0]*1000;
>> -	temp += (buffer[1] >> 6) * 250;
>> +	if (entry.len == 2) {
>> +		temp = buffer[0]*1000;
>> +		temp += (buffer[1] >> 6) * 250;
>> +	} else {
>> +		temp = buffer[0] * 4000;
>> +	}
> 
> Another comment - in the next patch, you check for entry.len == 0.
> If that can happen, you would need to check it here as well.


It cannot happen after a succesful return from get_entry(), but I will check it
again. Earlier versions used entry.len rather than entry.valid, which can still
be seen in a few places.

Thanks,
Henrik

  reply	other threads:[~2010-11-05  8:35 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-31  7:50 [PATCH 0/8] hwmon: applesmc: Dynamic configuration rewrite Henrik Rydberg
2010-10-31  7:50 ` [PATCH 1/8] hwmon: applesmc: Relax the severity of device init failure Henrik Rydberg
2010-11-02 16:03   ` [lm-sensors] " Guenter Roeck
2010-11-03 14:45     ` Henrik Rydberg
2010-10-31  7:50 ` [PATCH 2/8] hwmon: applesmc: Introduce a register lookup table Henrik Rydberg
2010-11-04  4:21   ` [lm-sensors] " Guenter Roeck
2010-11-04  8:20     ` Henrik Rydberg
2010-10-31  7:50 ` [PATCH 3/8] hwmon: applesmc: Dynamic creation of temperature files Henrik Rydberg
2010-11-05  2:23   ` [lm-sensors] " Guenter Roeck
2010-10-31  7:50 ` [PATCH 4/8] hwmon: applesmc: Handle new temperature format Henrik Rydberg
2010-11-05  2:32   ` [lm-sensors] " Guenter Roeck
2010-11-05  2:35   ` Guenter Roeck
2010-11-05  8:34     ` Henrik Rydberg [this message]
2010-10-31  7:50 ` [PATCH 5/8] hwmon: applesmc: Extract all features generically Henrik Rydberg
2010-11-05  2:50   ` [lm-sensors] " Guenter Roeck
2010-11-05  8:52     ` Henrik Rydberg
2010-10-31  7:50 ` [PATCH 6/8] hwmon: applesmc: Dynamic creation of fan files Henrik Rydberg
2010-11-05  2:59   ` [lm-sensors] " Guenter Roeck
2010-11-05  8:56     ` Henrik Rydberg
2010-10-31  7:50 ` [PATCH 7/8] hwmon: applesmc: Simplify feature sysfs handling Henrik Rydberg
2010-11-05  3:07   ` [lm-sensors] " Guenter Roeck
2010-10-31  7:50 ` [PATCH 8/8] hwmon: applesmc: Update copyright information Henrik Rydberg
2010-11-05  3:09   ` [lm-sensors] " Guenter Roeck
2010-11-05  9:00     ` Henrik Rydberg
2010-11-05 11:45       ` Guenter Roeck
2010-10-31  8:31 ` [PATCH 0/8] hwmon: applesmc: Dynamic configuration rewrite Joe Perches
2010-10-31  8:44   ` Henrik Rydberg
2010-10-31  8:55     ` Joe Perches
2010-10-31 10:05     ` Jean Delvare
2010-11-03 13:48 ` [lm-sensors] " Guenter Roeck
2010-11-03 14:43   ` Henrik Rydberg

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=4CD3C1A8.5050305@euromail.se \
    --to=rydberg@euromail.se \
    --cc=guenter.roeck@ericsson.com \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.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