mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tanhuazhong <tanhuazhong@huawei.com>
To: Joe Perches <joe@perches.com>, <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<salil.mehta@huawei.com>, <yisen.zhuang@huawei.com>,
	<linuxarm@huawei.com>, <jakub.kicinski@netronome.com>,
	Guojia Liao <liaoguojia@huawei.com>
Subject: Re: [PATCH net-next 8/9] net: hns3: cleanup some print format warning
Date: Fri, 1 Nov 2019 09:17:40 +0800	[thread overview]
Message-ID: <ce0c5f5f-08b7-7e38-b156-954a8398abfa@huawei.com> (raw)
In-Reply-To: <4541e77d257685c649f5f994e673a409a3634f50.camel@perches.com>



On 2019/10/31 19:53, Joe Perches wrote:
> On Thu, 2019-10-31 at 19:23 +0800, Huazhong Tan wrote:
>> From: Guojia Liao <liaoguojia@huawei.com>
>>
>> Using '%d' for printing type unsigned int or '%u' for
>> type int would cause static tools to give false warnings,
>> so this patch cleanups this warning by using the suitable
>> format specifier of the type of variable.
>>
>> BTW, modifies the type of some variables and macro to
>> synchronize with their usage.
> 
> What tool is this?

Sorry, it is my mistake, as confirmed, this patch is
advised by internal code review.

> 
> I think this static warning is excessive as macro
> defines with a small positive number are common
> 

yes, it seems ok.
The reason we do this modification is that
printing resp_data_len with '%u' and printing
HCLGE_MBX_MAX_RESP_DATA_SIZE with '%d' seems a little odd.

  	if (resp_data_len > HCLGE_MBX_MAX_RESP_DATA_SIZE) {
  		dev_err(&hdev->pdev->dev,
-			"PF fail to gen resp to VF len %d exceeds max len %d\n",
+			"PF fail to gen resp to VF len %u exceeds max len %u\n",
  			resp_data_len,
  			HCLGE_MBX_MAX_RESP_DATA_SIZE);

Thanks for your suggestion.

>> diff --git a/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h b/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h
> []
>> @@ -72,7 +72,7 @@ enum hclge_mbx_vlan_cfg_subcode {
>>   };
>>   
>>   #define HCLGE_MBX_MAX_MSG_SIZE	16
>> -#define HCLGE_MBX_MAX_RESP_DATA_SIZE	8
>> +#define HCLGE_MBX_MAX_RESP_DATA_SIZE	8U
>>   #define HCLGE_MBX_RING_MAP_BASIC_MSG_NUM	3
>>   #define HCLGE_MBX_RING_NODE_VARIABLE_NUM	3
> 
> like this one
> 
>> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
> []
>> @@ -57,68 +57,68 @@ static int hns3_dbg_queue_info(struct hnae3_handle *h,
>>   					   HNS3_RING_RX_RING_BASEADDR_H_REG);
>>   		base_add_l = readl_relaxed(ring->tqp->io_base +
>>   					   HNS3_RING_RX_RING_BASEADDR_L_REG);
>> -		dev_info(&h->pdev->dev, "RX(%d) BASE ADD: 0x%08x%08x\n", i,
>> +		dev_info(&h->pdev->dev, "RX(%u) BASE ADD: 0x%08x%08x\n", i,
> 
> so using %d is correct enough.
> 
> 
> 
> .
> 


  reply	other threads:[~2019-11-01  1:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-31 11:23 [PATCH net-next 0/9] net: hns3: add some optimizations ane cleanups Huazhong Tan
2019-10-31 11:23 ` [PATCH net-next 1/9] net: hns3: dump some debug information when reset fail Huazhong Tan
2019-10-31 11:23 ` [PATCH net-next 2/9] net: hns3: add struct netdev_queue debug info for TX timeout Huazhong Tan
2019-10-31 11:23 ` [PATCH net-next 3/9] net: hns3: cleanup some magic numbers Huazhong Tan
2019-10-31 11:23 ` [PATCH net-next 4/9] net: hns3: cleanup some coding style issues Huazhong Tan
2019-10-31 11:23 ` [PATCH net-next 5/9] net: hns3: cleanup a format-truncation warning Huazhong Tan
2019-10-31 11:23 ` [PATCH net-next 6/9] net: hns3: optimize local variable initialization Huazhong Tan
2019-10-31 11:23 ` [PATCH net-next 7/9] net: hns3: add or modify some comments Huazhong Tan
2019-10-31 11:23 ` [PATCH net-next 8/9] net: hns3: cleanup some print format warning Huazhong Tan
2019-10-31 11:53   ` Joe Perches
2019-11-01  1:17     ` tanhuazhong [this message]
2019-10-31 11:23 ` [PATCH net-next 9/9] net: hns3: cleanup byte order issues when printed Huazhong Tan
2019-10-31 19:03 ` [PATCH net-next 0/9] net: hns3: add some optimizations ane cleanups David Miller

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=ce0c5f5f-08b7-7e38-b156-954a8398abfa@huawei.com \
    --to=tanhuazhong@huawei.com \
    --cc=davem@davemloft.net \
    --cc=jakub.kicinski@netronome.com \
    --cc=joe@perches.com \
    --cc=liaoguojia@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=salil.mehta@huawei.com \
    --cc=yisen.zhuang@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

all inboxes | Powered by JetHome®