提交 269d417f 编写于 作者: G Guojia Liao 提交者: Zheng Zengkai

net: hns3: clean up a type mismatch warning

mainline inclusion
from mainline-v5.15-rc1
commit e79c0e32
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I4BY3P
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e79c0e324b011b0288cd411a5b53870a7730f163

----------------------------------------------------------------------

abs() returns signed long, which could not convert the type
as unsigned, and it may cause a mismatch type warning from
static tools. To fix it, this patch uses an variable to save
the abs()'s result and does a explicit conversion.
Signed-off-by: NGuojia Liao <liaoguojia@huawei.com>
Signed-off-by: NGuangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Reviewed-by: NYongxin Li <liyongxin1@huawei.com>
Signed-off-by: NJunxin Chen <chenjunxin1@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 04cec09f
......@@ -10,7 +10,14 @@
static u16 hclge_errno_to_resp(int errno)
{
return abs(errno);
int resp = abs(errno);
/* The status for pf to vf msg cmd is u16, constrainted by HW.
* We need to keep the same type with it.
* The intput errno is the stander error code, it's safely to
* use a u16 to store the abs(errno).
*/
return (u16)resp;
}
/* hclge_gen_resp_to_vf: used to generate a synchronous response to VF when PF
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册