Skip to contentSkip to conversation

Signdness issue in drivers/video/intelfb/intelfbdrv.c

PATCH NAK Eric Sesterhenn 2 participants 2 messages Aug 20, 2006 – Aug 22, 2006 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Signdness issue in drivers/video/intelfb/intelfbdrv.c

hi,

another gcc 4.1 signess warning:

drivers/video/intelfb/intelfbdrv.c:419: warning: comparison of unsigned expression < 0 is always false

since dinfo->mtrr_reg is of the type u32, the error check dinfo->mtrr_reg < 0 is useless. This patch introduces a helper variable, which catches possible negative error values returned by mtrr_add()

drivers/video/intelfb/intelfbdrv.c renamed from drivers/video/intelfb/intelfbdrv.c.orig +3 -2
@@ -414,12 +414,13 @@ module_exit(intelfb_exit);
 #ifdef CONFIG_MTRR
 static inline void __devinit set_mtrr(struct intelfb_info *dinfo)
 {
-	dinfo->mtrr_reg = mtrr_add(dinfo->aperture.physical,
+	int mtrr_reg = mtrr_add(dinfo->aperture.physical,
 				   dinfo->aperture.size, MTRR_TYPE_WRCOMB, 1);
-	if (dinfo->mtrr_reg < 0) {
+	if (mtrr_reg < 0) {
 		ERR_MSG("unable to set MTRR\n");
 		return;
 	}
+	dinfo->mtrr_reg = mtrr_reg;
 	dinfo->has_mtrr = 1;
 }
 static inline void unset_mtrr(struct intelfb_info *dinfo)
#1 lore raw
Quoted 4 lines · Eric Sesterhenn

hi,

another gcc 4.1 signess warning:

Quoted 8 lines

drivers/video/intelfb/intelfbdrv.c:419: warning: comparison of unsigned expression < 0 is always false

since dinfo->mtrr_reg is of the type u32, the error check dinfo->mtrr_reg < 0 is useless. This patch introduces a helper variable, which catches possible negative error values returned by mtrr_add()

NAK.
I've applied a much simpler fix to use make mtrr_reg an int to my intelfb tree....

Dave.