Skip to content

Commit

Permalink
werror: fix pci calgary
Browse files Browse the repository at this point in the history
Fix an integer comparison always false warning in the PCI Calgary 64 driver.

A u8 is being compared to something that's 512 by default, resulting in the
following warning:

arch/x86/kernel/pci-calgary_64.c:1285: warning: comparison is always false due to limited range of data type

This was introduced by patch b34e90b.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
David Howells authored and Ingo Molnar committed Aug 21, 2008
1 parent 80a8c9f commit 85d5779
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions arch/x86/kernel/pci-calgary_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -1269,13 +1269,15 @@ static inline int __init determine_tce_table_size(u64 ram)
static int __init build_detail_arrays(void)
{
unsigned long ptr;
int i, scal_detail_size, rio_detail_size;
unsigned numnodes, i;
int scal_detail_size, rio_detail_size;

if (rio_table_hdr->num_scal_dev > MAX_NUMNODES){
numnodes = rio_table_hdr->num_scal_dev;
if (numnodes > MAX_NUMNODES){
printk(KERN_WARNING
"Calgary: MAX_NUMNODES too low! Defined as %d, "
"but system has %d nodes.\n",
MAX_NUMNODES, rio_table_hdr->num_scal_dev);
MAX_NUMNODES, numnodes);
return -ENODEV;
}

Expand All @@ -1296,8 +1298,7 @@ static int __init build_detail_arrays(void)
}

ptr = ((unsigned long)rio_table_hdr) + 3;
for (i = 0; i < rio_table_hdr->num_scal_dev;
i++, ptr += scal_detail_size)
for (i = 0; i < numnodes; i++, ptr += scal_detail_size)
scal_devs[i] = (struct scal_detail *)ptr;

for (i = 0; i < rio_table_hdr->num_rio_dev;
Expand Down

0 comments on commit 85d5779

Please sign in to comment.