]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
powerpc/macintosh: Fix unsigned check in smu_sat_get_sdb_partition()
authorroel kluin <roel.kluin@gmail.com>
Sat, 29 Nov 2008 01:17:27 +0000 (01:17 +0000)
committerPaul Mackerras <paulus@samba.org>
Wed, 3 Dec 2008 10:04:02 +0000 (21:04 +1100)
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

index 7f2be4baaedab9cec03e721a5733e864d10016bb..7847e981ac33eaeaead929137aa68e0ef13937f2 100644 (file)
@@ -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;