Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

roel kluin and committed by
Paul Mackerras
2fd091f3 e6a437eb

+3 -2
+3 -2
drivers/macintosh/windfarm_smu_sat.c
··· 87 87 return NULL; 88 88 } 89 89 90 - len = i2c_smbus_read_word_data(&sat->i2c, 9); 91 - if (len < 0) { 90 + err = i2c_smbus_read_word_data(&sat->i2c, 9); 91 + if (err < 0) { 92 92 printk(KERN_ERR "smu_sat_get_sdb_part rd len error\n"); 93 93 return NULL; 94 94 } 95 + len = err; 95 96 if (len == 0) { 96 97 printk(KERN_ERR "smu_sat_get_sdb_part no partition %x\n", id); 97 98 return NULL;