Skip to contentSkip to conversation

Avoid implicit constant truncation

PATCH In review [email protected] 3 participants 4 messages Mar 3, 2010 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Avoid implicit constant truncation

From: Ian Munsie <[email protected]>

When building on 64 bit platforms, the compiler throws the following warning:

drivers/pci/probe.c:197: warning: large integer implicitly truncated to unsigned type

This patch adds an explicit truncation to silence the compiler warning.

---
 drivers/pci/probe.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/pci/probe.c +1 -1
index 2a94309..c5d9668 100644
@@ -195,7 +195,7 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
 		res->flags |= pci_calc_resource_flags(l) | IORESOURCE_SIZEALIGN;
 		if (type == pci_bar_io) {
 			l &= PCI_BASE_ADDRESS_IO_MASK;
-			mask = PCI_BASE_ADDRESS_IO_MASK & IO_SPACE_LIMIT;
+			mask = (u32)(PCI_BASE_ADDRESS_IO_MASK & IO_SPACE_LIMIT);
 		} else {
 			l &= PCI_BASE_ADDRESS_MEM_MASK;
 			mask = (u32)PCI_BASE_ADDRESS_MEM_MASK;
Signature · 1 line
1.6.6.1
#1 lore raw
Quoted 8 lines · On 03/02/10 16:01, [email protected] wrote:

From: Ian Munsie <[email protected]>

When building on 64 bit platforms, the compiler throws the following warning:

drivers/pci/probe.c:197: warning: large integer implicitly truncated to unsigned type

This patch adds an explicit truncation to silence the compiler warning.

Please see/read/use Documentation/SubmittingPatches. E.g.:

The canonical patch subject line is:

Subject: [PATCH 001/123] subsystem: summary phrase

I.e., the subject: should tell us that this is a PCI: patch.

(or even pci: -- i don't care which)

thanks,

Signature · 1 line
~Randy
author
#2 lore raw
Quoted 7 lines · Randy Dunlap

The canonical patch subject line is:

Subject: [PATCH 001/123] subsystem: summary phrase

I.e., the subject: should tell us that this is a PCI: patch.

(or even pci: -- i don't care which)

Appologies and thanks for the pointer - I'm new to this.

Cheers,
-Ian

#3 lore raw
In reply to Randy Dunlap
Quoted 15 lines · On Tue, 02 Mar 2010 16:06:33 -0800 Randy Dunlap <[email protected]> wrote:
Quoted 10 lines · On 03/02/10 16:01, [email protected] wrote:

From: Ian Munsie <[email protected]>

When building on 64 bit platforms, the compiler throws the following warning:

drivers/pci/probe.c:197: warning: large integer implicitly truncated to unsigned type

This patch adds an explicit truncation to silence the compiler warning.

Please see/read/use Documentation/SubmittingPatches. E.g.:

Quoted 7 lines

The canonical patch subject line is:

Subject: [PATCH 001/123] subsystem: summary phrase

I.e., the subject: should tell us that this is a PCI: patch.

(or even pci: -- i don't care which)

No need to resubmit though; I usually have to fix up the summary and changelog a bit when applying anyway.

That said, this patch rings a bell; I think the warning is signalling a real bug in the ppc code. IIRC Ben was going to look at it awhile back, but I think it's mostly harmless so it's probably low on his list.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center