提交 c968ed08 编写于 作者: L Luck, Tony 提交者: Borislav Petkov

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: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NTony 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-deskSigned-off-by: NBorislav Petkov <bp@suse.de>
上级 8489b17c
...@@ -1027,14 +1027,14 @@ static u8 ibridge_get_ha(u8 bank) ...@@ -1027,14 +1027,14 @@ static u8 ibridge_get_ha(u8 bank)
case 9 ... 16: case 9 ... 16:
return (bank - 9) / 4; return (bank - 9) / 4;
default: default:
return -EINVAL; return 0xff;
} }
} }
/* Not used, but included for safety/symmetry */ /* Not used, but included for safety/symmetry */
static u8 knl_get_ha(u8 bank) static u8 knl_get_ha(u8 bank)
{ {
return -EINVAL; return 0xff;
} }
static u64 haswell_get_tolm(struct sbridge_pvt *pvt) static u64 haswell_get_tolm(struct sbridge_pvt *pvt)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册