Skip to content

Commit

Permalink
powerpc/macintosh: Fix unsigned check in smu_sat_get_sdb_partition()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
RoelKluin authored and paulusmack committed Dec 3, 2008
1 parent e6a437e commit 2fd091f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/macintosh/windfarm_smu_sat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2fd091f

Please sign in to comment.