Skip to content

Commit e79c0e3

Browse files
Guojia Liaodavem330
authored andcommitted
net: hns3: clean up a type mismatch warning
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: Guojia Liao <[email protected]> Signed-off-by: Guangbin Huang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent dc9b5ce commit e79c0e3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@
1010

1111
static u16 hclge_errno_to_resp(int errno)
1212
{
13-
return abs(errno);
13+
int resp = abs(errno);
14+
15+
/* The status for pf to vf msg cmd is u16, constrainted by HW.
16+
* We need to keep the same type with it.
17+
* The intput errno is the stander error code, it's safely to
18+
* use a u16 to store the abs(errno).
19+
*/
20+
return (u16)resp;
1421
}
1522

1623
/* hclge_gen_resp_to_vf: used to generate a synchronous response to VF when PF

0 commit comments

Comments
 (0)