Skip to contentSkip to conversation

Remove a warning for drivers/edac/i82975x_edac.c

PATCH Superseded Harry Wei 2 participants 3 messages Jun 4, 2011 – Jun 7, 2011

Subsystems (2)
lore
Share & tools
lore

Harry Wei

author
#0 lore raw

PATCH 1/1 Remove a warning for drivers/edac/i82975x_edac.c

From: Harry Wei <[email protected]>

When i compile 2.6.39.1, a warning shows like below. This patch can fix the warning. And i works well with my PC.

[...]

CC [M]  drivers/edac/e752x_edac.o
CC [M]  drivers/edac/i82875p_edac.o
CC [M]  drivers/edac/i82975x_edac.o
drivers/edac/i82975x_edac.c: In function ���i82975x_process_error_info���:
drivers/edac/i82975x_edac.c:298: warning: integer constant is too large for ���unsigned long��� type
CC [M]  drivers/edac/i3000_edac.o
CC [M]  drivers/edac/i3200_edac.o
CC [M]  drivers/edac/x38_edac.o
CC [M]  drivers/edac/i82860_edac.o

[...]

drivers/edac/i82975x_edac.c +2 -2
Index: prj/drivers/edac/i82975x_edac.c
===================================================================
@@ -293,9 +293,9 @@
 		info->errsts = info->errsts2;
 	}
 
-	page = (unsigned long) info->eap;
+	page = (unsigned long long) info->eap;
 	if (info->xeap & 1)
-		page |= 0x100000000ul;
+		page |= 0x100000000ull;
 	chan = page & 1;
 	page >>= 1;
 	offst = page & ((1 << PAGE_SHIFT) - 1);
#1 lore raw
Quoted 5 lines · On Sat, 4 Jun 2011 10:22:21 +0800 Harry Wei wrote:

From: Harry Wei <[email protected]>

When i compile 2.6.39.1, a warning shows like below. This patch can fix the warning. And i works well with my PC.

Hi Harry,

Does "works well with my PC" mean that you boot-tested this patch or just compile-tested it?

and if you boot-tested it, do you have hardware that actually exercises this code path?

Quoted 19 lines

[...]

CC [M]  drivers/edac/e752x_edac.o
CC [M]  drivers/edac/i82875p_edac.o
CC [M]  drivers/edac/i82975x_edac.o
drivers/edac/i82975x_edac.c: In function ���i82975x_process_error_info���:
drivers/edac/i82975x_edac.c:298: warning: integer constant is too large for ���unsigned long��� type
CC [M]  drivers/edac/i3000_edac.o
CC [M]  drivers/edac/i3200_edac.o
CC [M]  drivers/edac/x38_edac.o
CC [M]  drivers/edac/i82860_edac.o

[...]

Index: prj/drivers/edac/i82975x_edac.c
===================================================================

drivers/edac/i82975x_edac.c line 296

Quoted 5 lines
drivers/edac/i82975x_edac.c +1 -1
@@ -293,9 +293,9 @@
 		info->errsts = info->errsts2;
 	}
 
-	page = (unsigned long) info->eap;
+	page = (unsigned long long) info->eap;

but page is still declared as unsigned long. should it be unsigned long long?

drivers/edac/i82975x_edac.c line 301

Quoted 6 lines
drivers/edac/i82975x_edac.c +1 -1
 	if (info->xeap & 1)
-		page |= 0x100000000ul;
+		page |= 0x100000000ull;
 	chan = page & 1;
 	page >>= 1;
 	offst = page & ((1 << PAGE_SHIFT) - 1);

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Discover what all the cheering's about. Get your free trial download today.
http://p.sf.net/sfu/quest-dev2dev2
_______________________________________________
bluesmoke-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluesmoke-devel

author
#2 lore raw
Quoted 4 lines · Randy Dunlap
Quoted 2 lines · On Sat, 4 Jun 2011 10:22:21 +0800 Harry Wei wrote:

From: Harry Wei <[email protected]>

Quoted 8 lines
Quoted 3 lines

When i compile 2.6.39.1, a warning shows like below. This patch can fix the warning. And i works well with my PC.

Hi Harry,

Does "works well with my PC" mean that you boot-tested this patch or just compile-tested it?

No, i just test with the following codes.

#include <stdio.h>

int main(void)

{
	unsigned long a;

	a = 0x100000000ul;
	printf("%lu\n", a);
	return 0;
}
jiawei@jiawei-laptop:~/GTK$ gcc 5.c -Wall -o 1
5.c: In function ‘main’:
5.c:7: warning: integer constant is too large for ‘unsigned long’ type
5.c:7: warning: large integer implicitly truncated to unsigned type

But if you program it like below, it is well for us.

#include <stdio.h>

int main(void)

{
	unsigned long long a;

	a = 0x100000000ull;

	printf("%llu\n", a);
	return 0;
}
Quoted 26 lines

and if you boot-tested it, do you have hardware that actually exercises this code path?

Quoted 22 lines

[...]

CC [M]  drivers/edac/e752x_edac.o
CC [M]  drivers/edac/i82875p_edac.o
CC [M]  drivers/edac/i82975x_edac.o
drivers/edac/i82975x_edac.c: In function ?????????i82975x_process_error_info?????????:
drivers/edac/i82975x_edac.c:298: warning: integer constant is too large for ?????????unsigned long????????? type
CC [M]  drivers/edac/i3000_edac.o
CC [M]  drivers/edac/i3200_edac.o
CC [M]  drivers/edac/x38_edac.o
CC [M]  drivers/edac/i82860_edac.o

[...]

Index: prj/drivers/edac/i82975x_edac.c
===================================================================

drivers/edac/i82975x_edac.c +0 -0
@@ -293,9 +293,9 @@
 		info->errsts = info->errsts2;
 	}
 
Quoted 4 lines

drivers/edac/i82975x_edac.c line 296

Quoted 2 lines
drivers/edac/i82975x_edac.c +1 -1
-	page = (unsigned long) info->eap;
+	page = (unsigned long long) info->eap;

but page is still declared as unsigned long. should it be unsigned long long?

I think it should be unsigned long long, unsigned long can not store 0x100000000. It has been beyond its reach. So unsigned long long is well for us.

Quoted 9 lines
Quoted 7 lines
drivers/edac/i82975x_edac.c +1 -1
 	if (info->xeap & 1)
-		page |= 0x100000000ul;
+		page |= 0x100000000ull;
 	chan = page & 1;
 	page >>= 1;
 	offst = page & ((1 << PAGE_SHIFT) - 1);