]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: hns3: Align type of some variables with their print type
authorHao Chen <chenhao288@hisilicon.com>
Fri, 3 Dec 2021 09:20:52 +0000 (17:20 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Jan 2026 12:09:45 +0000 (13:09 +0100)
[ Upstream commit 0cc25c6a14efd709f2cfcde345e3d5c6aa20f80e ]

The c language has a set of implicit type conversions, when
two variables perform bitwise or arithmetic operations.

For example, variable A (type u16/u8) -1, its output is int type variable.
u16/u8 will convert to int type implicitly before it does arithmetic
operations. So, change 1 to unsigned type.

Signed-off-by: Hao Chen <chenhao288@hisilicon.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Stable-dep-of: d180c11aa8a6 ("net: hns3: using the num_tqps to check whether tqp_index is out of range when vf get ring info from mbx")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c

index 63665e8a7c718f31a2e9217fe2e1ee82a6e6fbc9..016cd7cf119319766bfe22e6721fb48c4e7627bc 100644 (file)
@@ -99,7 +99,7 @@ static void hclge_dbg_fill_content(char *content, u16 len,
 static char *hclge_dbg_get_func_id_str(char *buf, u8 id)
 {
        if (id)
-               sprintf(buf, "vf%u", id - 1);
+               sprintf(buf, "vf%u", id - 1U);
        else
                sprintf(buf, "pf");
 
index 492a754f84a947f62c8484a982282e59c7197a6d..1dffd1532bd76fcd5c846074c70a8e0238da2a39 100644 (file)
@@ -6692,7 +6692,7 @@ static int hclge_fd_parse_ring_cookie(struct hclge_dev *hdev, u64 ring_cookie,
                if (vf > hdev->num_req_vfs) {
                        dev_err(&hdev->pdev->dev,
                                "Error: vf id (%u) should be less than %u\n",
-                               vf - 1, hdev->num_req_vfs);
+                               vf - 1U, hdev->num_req_vfs);
                        return -EINVAL;
                }
 
@@ -6702,7 +6702,7 @@ static int hclge_fd_parse_ring_cookie(struct hclge_dev *hdev, u64 ring_cookie,
                if (ring >= tqps) {
                        dev_err(&hdev->pdev->dev,
                                "Error: queue id (%u) > max tqp num (%u)\n",
-                               ring, tqps - 1);
+                               ring, tqps - 1U);
                        return -EINVAL;
                }
 
index e2fe41d3972fb0148e899cfe671984975b156f6e..e2cd0eb124bac7e7c59f7c234b9a675c352fed94 100644 (file)
@@ -190,7 +190,7 @@ static int hclge_get_ring_chain_from_mbx(
                if (req->msg.param[i].tqp_index >= vport->nic.kinfo.rss_size) {
                        dev_err(&hdev->pdev->dev, "tqp index(%u) is out of range(0-%u)\n",
                                req->msg.param[i].tqp_index,
-                               vport->nic.kinfo.rss_size - 1);
+                               vport->nic.kinfo.rss_size - 1U);
                        return -EINVAL;
                }
        }