powerpc/macintosh: Fix unsigned check in smu_sat_get_sdb_partition()

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Sunday, December 28, 2008 - 6:01 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2fd091...
Commit:     2fd091f3eebc5accefa5f77ff04436982765d15c
Parent:     e6a437eba09f1c3505bedf7a9a9766a878ca09fa
Author:     roel kluin <roel.kluin@gmail.com>
AuthorDate: Sat Nov 29 01:17:27 2008 +0000
Committer:  Paul Mackerras <paulus@samba.org>
CommitDate: Wed Dec 3 21:04:02 2008 +1100

    powerpc/macintosh: Fix unsigned check in smu_sat_get_sdb_partition()
    
    i2c_smbus_read_word_data() returns a s32, which may be negative
    but unsigned len cannot be negative.
    
    Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
    Signed-off-by: Paul Mackerras <paulus@samba.org>
---
 drivers/macintosh/windfarm_smu_sat.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/macintosh/windfarm_smu_sat.c b/drivers/macintosh/windfarm_smu_sat.c
index 7f2be4b..7847e98 100644
--- a/drivers/macintosh/windfarm_smu_sat.c
+++ b/drivers/macintosh/windfarm_smu_sat.c
@@ -87,11 +87,12 @@ struct smu_sdbp_header *smu_sat_get_sdb_partition(unsigned int sat_id, int id,
 		return NULL;
 	}
 
-	len = i2c_smbus_read_word_data(&sat->i2c, 9);
-	if (len < 0) {
+	err = i2c_smbus_read_word_data(&sat->i2c, 9);
+	if (err < 0) {
 		printk(KERN_ERR "smu_sat_get_sdb_part rd len error\n");
 		return NULL;
 	}
+	len = err;
 	if (len == 0) {
 		printk(KERN_ERR "smu_sat_get_sdb_part no partition %x\n", id);
 		return NULL;
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
powerpc/macintosh: Fix unsigned check in smu_sat_get_sdb_p ..., Linux Kernel Mailing ..., (Sun Dec 28, 6:01 pm)