All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [POWERPC] smu_sat_get_sdb_partition() - unsigned len cannot be negative
@ 2008-11-29 11:17 roel kluin
  0 siblings, 0 replies; only message in thread
From: roel kluin @ 2008-11-29 11:17 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev, linux-kernel

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>
---
for i2c_smbus_read_word_data(), see
vi drivers/i2c/i2c-core.c +1663

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;

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2008-11-29 11:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-29 11:17 [PATCH] [POWERPC] smu_sat_get_sdb_partition() - unsigned len cannot be negative roel kluin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.