Commit 2fd091f3 authored by roel kluin's avatar roel kluin Committed by Paul Mackerras

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: default avatarRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent e6a437eb
...@@ -87,11 +87,12 @@ struct smu_sdbp_header *smu_sat_get_sdb_partition(unsigned int sat_id, int id, ...@@ -87,11 +87,12 @@ struct smu_sdbp_header *smu_sat_get_sdb_partition(unsigned int sat_id, int id,
return NULL; return NULL;
} }
len = i2c_smbus_read_word_data(&sat->i2c, 9); err = i2c_smbus_read_word_data(&sat->i2c, 9);
if (len < 0) { if (err < 0) {
printk(KERN_ERR "smu_sat_get_sdb_part rd len error\n"); printk(KERN_ERR "smu_sat_get_sdb_part rd len error\n");
return NULL; return NULL;
} }
len = err;
if (len == 0) { if (len == 0) {
printk(KERN_ERR "smu_sat_get_sdb_part no partition %x\n", id); printk(KERN_ERR "smu_sat_get_sdb_part no partition %x\n", id);
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment