From: "shenjian (K)" <shenjian15@huawei.com>
To: Huazhong Tan <tanhuazhong@huawei.com>, <davem@davemloft.net>
Cc: <salil.mehta@huawei.com>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <linuxarm@huawei.com>,
<kuba@kernel.org>
Subject: Re: [PATCH net-next 1/9] net: hns3: fix some mixed type assignment
Date: Fri, 6 Mar 2020 11:39:29 +0800 [thread overview]
Message-ID: <03bf7b86-6674-163a-5df2-1840966de960@huawei.com> (raw)
In-Reply-To: <1583463438-60953-2-git-send-email-tanhuazhong@huawei.com>
在 2020/3/6 10:57, Huazhong Tan 写道:
> From: Guojia Liao <liaoguojia@huawei.com>
>
> This patch cleans up some incorrect type in assignment reported by sparse
> and compiler.
> The warning as below:
> - warning : restricted __le16 degrades to integer
> - warning : cast from restricted __le32
> - warning : cast from restricted __be32
> - warning : cast from restricted __be16
> and "mixed operation".
>
> Signed-off-by: Guojia Liao <liaoguojia@huawei.com>
> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
should add fixes id.
> ---
> .../ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c | 23 ++++++++++++----------
> .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 3 ++-
> 2 files changed, 15 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c
> index 6295cf9..5b4045c 100644
> --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c
> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c
> @@ -87,7 +87,7 @@ static int hclge_dbg_get_dfx_bd_num(struct hclge_dev *hdev, int offset)
>
> entries_per_desc = ARRAY_SIZE(desc[0].data);
> index = offset % entries_per_desc;
> - return (int)desc[offset / entries_per_desc].data[index];
> + return le32_to_cpu(desc[offset / entries_per_desc].data[index]);
> }
>
> static int hclge_dbg_cmd_send(struct hclge_dev *hdev,
> @@ -583,7 +583,7 @@ static void hclge_dbg_dump_tm_map(struct hclge_dev *hdev,
> ret = hclge_cmd_send(&hdev->hw, &desc, 1);
> if (ret)
> goto err_tm_map_cmd_send;
> - qset_id = nq_to_qs_map->qset_id & 0x3FF;
> + qset_id = le16_to_cpu(nq_to_qs_map->qset_id) & 0x3FF;
>
> cmd = HCLGE_OPC_TM_QS_TO_PRI_LINK;
> map = (struct hclge_qs_to_pri_link_cmd *)desc.data;
> @@ -623,7 +623,8 @@ static void hclge_dbg_dump_tm_map(struct hclge_dev *hdev,
> if (ret)
> goto err_tm_map_cmd_send;
>
> - qset_maping[group_id] = bp_to_qs_map_cmd->qs_bit_map;
> + qset_maping[group_id] =
> + le32_to_cpu(bp_to_qs_map_cmd->qs_bit_map);
> }
>
> dev_info(&hdev->pdev->dev, "index | tm bp qset maping:\n");
> @@ -826,6 +827,7 @@ static void hclge_dbg_dump_mng_table(struct hclge_dev *hdev)
> struct hclge_mac_ethertype_idx_rd_cmd *req0;
> char printf_buf[HCLGE_DBG_BUF_LEN];
> struct hclge_desc desc;
> + u32 msg_egress_port;
> int ret, i;
>
> dev_info(&hdev->pdev->dev, "mng tab:\n");
> @@ -867,20 +869,21 @@ static void hclge_dbg_dump_mng_table(struct hclge_dev *hdev)
> HCLGE_DBG_BUF_LEN - strlen(printf_buf),
> "%x |%04x |%x |%04x|%x |%02x |%02x |",
> !!(req0->flags & HCLGE_DBG_MNG_MAC_MASK_B),
> - req0->ethter_type,
> + le16_to_cpu(req0->ethter_type),
> !!(req0->flags & HCLGE_DBG_MNG_ETHER_MASK_B),
> - req0->vlan_tag & HCLGE_DBG_MNG_VLAN_TAG,
> + le16_to_cpu(req0->vlan_tag) & HCLGE_DBG_MNG_VLAN_TAG,
> !!(req0->flags & HCLGE_DBG_MNG_VLAN_MASK_B),
> req0->i_port_bitmap, req0->i_port_direction);
>
> + msg_egress_port = le16_to_cpu(req0->egress_port);
> snprintf(printf_buf + strlen(printf_buf),
> HCLGE_DBG_BUF_LEN - strlen(printf_buf),
> "%d |%d |%02d |%04d|%x\n",
> - !!(req0->egress_port & HCLGE_DBG_MNG_E_TYPE_B),
> - req0->egress_port & HCLGE_DBG_MNG_PF_ID,
> - (req0->egress_port >> 3) & HCLGE_DBG_MNG_VF_ID,
> - req0->egress_queue,
> - !!(req0->egress_port & HCLGE_DBG_MNG_DROP_B));
> + !!(msg_egress_port & HCLGE_DBG_MNG_E_TYPE_B),
> + msg_egress_port & HCLGE_DBG_MNG_PF_ID,
> + (msg_egress_port >> 3) & HCLGE_DBG_MNG_VF_ID,
> + le16_to_cpu(req0->egress_queue),
> + !!(msg_egress_port & HCLGE_DBG_MNG_DROP_B));
msg_egress_port is unsigned, but print format is "%d" ?
>
> dev_info(&hdev->pdev->dev, "%s", printf_buf);
> }
> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
> index 89d3523..e64027c 100644
> --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
> @@ -10252,8 +10252,9 @@ static int hclge_dfx_reg_fetch_data(struct hclge_desc *desc_src, int bd_num,
> static int hclge_get_dfx_reg_len(struct hclge_dev *hdev, int *len)
> {
> u32 dfx_reg_type_num = ARRAY_SIZE(hclge_dfx_bd_offset_list);
> - int data_len_per_desc, data_len, bd_num, i;
> + int data_len_per_desc, bd_num, i;
> int bd_num_list[BD_LIST_MAX_NUM];
> + u32 data_len;
> int ret;
>
> ret = hclge_get_dfx_reg_bd_num(hdev, bd_num_list, dfx_reg_type_num);
next prev parent reply other threads:[~2020-03-06 3:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-06 2:57 [PATCH net-next 0/9] net: hns3: misc updates for -net-next Huazhong Tan
2020-03-06 2:57 ` [PATCH net-next 1/9] net: hns3: fix some mixed type assignment Huazhong Tan
2020-03-06 3:39 ` shenjian (K) [this message]
2020-03-06 6:18 ` tanhuazhong
2020-03-06 2:57 ` [PATCH net-next 2/9] net: hns3: rename macro HCLGE_MAX_NCL_CONFIG_LENGTH Huazhong Tan
2020-03-06 2:57 ` [PATCH net-next 3/9] net: hns3: remove an unnecessary resetting check in hclge_handle_hw_ras_error() Huazhong Tan
2020-03-06 2:57 ` [PATCH net-next 4/9] net: hns3: delete some reduandant code Huazhong Tan
2020-03-06 2:57 ` [PATCH net-next 5/9] net: hns3: add a check before PF inform VF to reset Huazhong Tan
2020-03-06 2:57 ` [PATCH net-next 6/9] net: hns3: print out status register when VF receives unknown source interrupt Huazhong Tan
2020-03-06 2:57 ` [PATCH net-next 7/9] net: hns3: print out command code when dump fails in debugfs Huazhong Tan
2020-03-06 2:57 ` [PATCH net-next 8/9] net: hns3: synchronize some print relating to reset issue Huazhong Tan
2020-03-06 2:57 ` [PATCH net-next 9/9] net: hns3: delete unnecessary logs after kzalloc fails Huazhong Tan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=03bf7b86-6674-163a-5df2-1840966de960@huawei.com \
--to=shenjian15@huawei.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=salil.mehta@huawei.com \
--cc=tanhuazhong@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).