Commit 351cb4d0 authored by Andrew Morton's avatar Andrew Morton Committed by Jeff Garzik

[PATCH] sata_sx4.c warning fix

drivers/scsi/sata_sx4.c: In function `pdc20621_put_to_dimm':
drivers/scsi/sata_sx4.c:928: warning: comparison is always true due to limited range of data type

The code is doing, effectively:

	if ((long)(expr returning u32)) >= 0

but on 64-bit architectures, that will always be true.

So cast the u32 result to s32 before promoting to long so that bit 31
correctly propagates into bits 32-63.
parent af5821d5
......@@ -925,7 +925,7 @@ static void pdc20621_put_to_dimm(struct ata_probe_ent *pe, void *psource,
readl(mmio + PDC_DIMM_WINDOW_CTLR);
offset -= (idx * window_size);
idx++;
dist = ((long) (window_size - (offset + size))) >= 0 ? size :
dist = ((long)(s32)(window_size - (offset + size))) >= 0 ? size :
(long) (window_size - offset);
memcpy_toio((char *) (dimm_mmio + offset / 4), (char *) psource, dist);
writel(0x01, mmio + PDC_GENERAL_CTLR);
......
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