Skip to content

Commit c968ed0

Browse files
aeglsuryasaimadhu
authored andcommitted
EDAC, sb_edac: Fix signedness bugs in *_get_ha() functions
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). Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Tony Luck <tony.luck@intel.com> Cc: Qiuxu Zhuo <qiuxu.zhuo@intel.com> Cc: linux-edac <linux-edac@vger.kernel.org> Link: http://lkml.kernel.org/r/20180914201905.GA30946@agluck-desk Signed-off-by: Borislav Petkov <bp@suse.de>
1 parent 8489b17 commit c968ed0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/edac/sb_edac.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,14 +1027,14 @@ static u8 ibridge_get_ha(u8 bank)
10271027
case 9 ... 16:
10281028
return (bank - 9) / 4;
10291029
default:
1030-
return -EINVAL;
1030+
return 0xff;
10311031
}
10321032
}
10331033

10341034
/* Not used, but included for safety/symmetry */
10351035
static u8 knl_get_ha(u8 bank)
10361036
{
1037-
return -EINVAL;
1037+
return 0xff;
10381038
}
10391039

10401040
static u64 haswell_get_tolm(struct sbridge_pvt *pvt)

0 commit comments

Comments
 (0)