summaryrefslogtreecommitdiff
path: root/drivers/edac
diff options
context:
space:
mode:
authorLuck, Tony <tony.luck@intel.com>2018-09-14 23:19:05 +0300
committerBorislav Petkov <bp@suse.de>2018-09-15 12:41:08 +0300
commitc968ed08594dadb788a93dc2bc128ed4ef35c93e (patch)
tree8448f6d981ed72aa90061e962a74622364989476 /drivers/edac
parent8489b17ce29d9a35a36c08bbea93cdce4c98a6ad (diff)
downloadlinux-c968ed08594dadb788a93dc2bc128ed4ef35c93e.tar.xz
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>
Diffstat (limited to 'drivers/edac')
-rw-r--r--drivers/edac/sb_edac.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c
index d4a10793f807..5aeb9a1ee898 100644
--- a/drivers/edac/sb_edac.c
+++ b/drivers/edac/sb_edac.c
@@ -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)