diff options
author | Amos Waterland <apw@us.ibm.com> | 2005-09-22 03:48:19 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-22 10:58:25 -0400 |
commit | 3c6de9295d28a4fc868b2c09f23e318e3e7b9b6b (patch) | |
tree | bc328ba9645a9d19c3b132f71e74ef3f7ed76f7a | |
parent | 656da9da3745abcbbbdca598745d04c6de2c8843 (diff) |
[PATCH] fix drivers/pci/probe.c warning
This function expects an unsigned 32-bit type as its third argument:
static u32 pci_size(u32 base, u32 maxbase, u32 mask)
However, given these definitions:
#define PCI_BASE_ADDRESS_MEM_MASK (~0x0fUL)
#define PCI_ROM_ADDRESS_MASK (~0x7ffUL)
these two calls in drivers/pci/probe.c are problematic for architectures
for which a UL is not equivalent to a u32:
sz = pci_size(l, sz, PCI_BASE_ADDRESS_MEM_MASK);
sz = pci_size(l, sz, PCI_ROM_ADDRESS_MASK);
Hence the below compile warning when building for ARCH=ppc64:
drivers/pci/probe.c: In function `pci_read_bases':
/.../probe.c:168: warning: large integer implicitly truncated to unsigned type
/.../probe.c:218: warning: large integer implicitly truncated to unsigned type
Here is a simple fix.
Signed-off-by: Amos Waterland <apw@us.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/pci/probe.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 26a55d08b506..c77d5b1bbff6 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -165,7 +165,7 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom) | |||
165 | if (l == 0xffffffff) | 165 | if (l == 0xffffffff) |
166 | l = 0; | 166 | l = 0; |
167 | if ((l & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_MEMORY) { | 167 | if ((l & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_MEMORY) { |
168 | sz = pci_size(l, sz, PCI_BASE_ADDRESS_MEM_MASK); | 168 | sz = pci_size(l, sz, (u32)PCI_BASE_ADDRESS_MEM_MASK); |
169 | if (!sz) | 169 | if (!sz) |
170 | continue; | 170 | continue; |
171 | res->start = l & PCI_BASE_ADDRESS_MEM_MASK; | 171 | res->start = l & PCI_BASE_ADDRESS_MEM_MASK; |
@@ -215,7 +215,7 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom) | |||
215 | if (l == 0xffffffff) | 215 | if (l == 0xffffffff) |
216 | l = 0; | 216 | l = 0; |
217 | if (sz && sz != 0xffffffff) { | 217 | if (sz && sz != 0xffffffff) { |
218 | sz = pci_size(l, sz, PCI_ROM_ADDRESS_MASK); | 218 | sz = pci_size(l, sz, (u32)PCI_ROM_ADDRESS_MASK); |
219 | if (sz) { | 219 | if (sz) { |
220 | res->flags = (l & IORESOURCE_ROM_ENABLE) | | 220 | res->flags = (l & IORESOURCE_ROM_ENABLE) | |
221 | IORESOURCE_MEM | IORESOURCE_PREFETCH | | 221 | IORESOURCE_MEM | IORESOURCE_PREFETCH | |