Skip to contentSkip to conversation

EDAC, sb_edac.c: Fix signedness bugs in *_get_ha() functions.

PATCH Luck, Tony 1 participant 1 message Sep 14, 2018

Subsystems (2)
lore
Share & tools
lore

Luck, Tony

author maintainer
#0 lore raw

A static checker gave the following warnings:

drivers/edac/sb_edac.c:1030 ibridge_get_ha() warn: signedness bug returning '(-22)' drivers/edac/sb_edac.c:1037 knl_get_ha() warn: signedness bug returning '(-22)'

Both because the functions are declared to return a "u8", but try to return -EINVAL for the error case.

Fix by returning 0xff (since the caller doesn't look at, or pass on, the return value).

---
 drivers/edac/sb_edac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/edac/sb_edac.c +2 -2
index ada2cc93df58..199b6100846a 100644
@@ -1027,14 +1027,14 @@ static u8 ibridge_get_ha(u8 bank)
 	case 9 ... 16:
 		return (bank - 9) / 4;
 	default:
-		return -EINVAL;
+		return 0xff;
 	}
 }
 
 /* Not used, but included for safety/symmetry */
 static u8 knl_get_ha(u8 bank)
 {
-	return -EINVAL;
+	return 0xff;
 }
 
 static u64 haswell_get_tolm(struct sbridge_pvt *pvt)