diff mbox series

drivers:net:wireless:mediatek: fix build warning

Message ID 20211022013843.3643856-1-wanghaojun@loongson.cn (mailing list archive)
State Superseded
Delegated to: Felix Fietkau
Headers show
Series drivers:net:wireless:mediatek: fix build warning | expand

Commit Message

Wang Haojun Oct. 22, 2021, 1:38 a.m. UTC
drivers/net/wireless/mediatek/mt76/mt7921/main.c: In function 'mt7921_get_et_stats':
drivers/net/wireless/mediatek/mt76/mt7921/main.c:1024:26: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
   dev_err(dev->mt76.dev, "ei: %d  SSTATS_LEN: %lu",

Signed-off-by: Wang Haojun <wanghaojun@loongson.cn>
---
 drivers/net/wireless/mediatek/mt76/mt7921/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kalle Valo Oct. 23, 2021, 7:16 a.m. UTC | #1
Wang Haojun <jiangliuer01@gmail.com> writes:

> drivers/net/wireless/mediatek/mt76/mt7921/main.c: In function 'mt7921_get_et_stats':
> drivers/net/wireless/mediatek/mt76/mt7921/main.c:1024:26: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]
>    dev_err(dev->mt76.dev, "ei: %d  SSTATS_LEN: %lu",
>
> Signed-off-by: Wang Haojun <wanghaojun@loongson.cn>
> ---
>  drivers/net/wireless/mediatek/mt76/mt7921/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> index 35a490c049e9..0b456431cb59 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> @@ -1021,7 +1021,7 @@ void mt7921_get_et_stats(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>  
>  	ei += wi.worker_stat_count;
>  	if (ei != ARRAY_SIZE(mt7921_gstrings_stats))
> -		dev_err(dev->mt76.dev, "ei: %d  SSTATS_LEN: %lu",
> +		dev_err(dev->mt76.dev, "ei: %d  SSTATS_LEN: %u",
>  			ei, ARRAY_SIZE(mt7921_gstrings_stats));
>  }

Randy used %zu, I'll take that version:

https://patchwork.kernel.org/project/linux-wireless/patch/20211022233251.29987-1-rdunlap@infradead.org/
kernel test robot Nov. 8, 2021, 9:49 p.m. UTC | #2
Hi Wang,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on kvalo-wireless-drivers-next/master]
[cannot apply to kvalo-wireless-drivers/master v5.15 next-20211108]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Wang-Haojun/drivers-net-wireless-mediatek-fix-build-warning/20211022-094003
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git master
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/938b093783657637b4f286daf797c950480249d5
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Wang-Haojun/drivers-net-wireless-mediatek-fix-build-warning/20211022-094003
        git checkout 938b093783657637b4f286daf797c950480249d5
        # save the attached .config to linux build tree
        make W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from include/linux/device.h:15,
                    from include/linux/dma-mapping.h:7,
                    from include/linux/skbuff.h:31,
                    from include/linux/if_ether.h:19,
                    from include/linux/etherdevice.h:20,
                    from drivers/net/wireless/mediatek/mt76/mt7921/main.c:4:
   drivers/net/wireless/mediatek/mt76/mt7921/main.c: In function 'mt7921_get_et_stats':
>> drivers/net/wireless/mediatek/mt76/mt7921/main.c:1024:26: error: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'long unsigned int' [-Werror=format=]
    1024 |   dev_err(dev->mt76.dev, "ei: %d  SSTATS_LEN: %u",
         |                          ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:110:16: note: in definition of macro 'dev_printk_index_wrap'
     110 |   _p_func(dev, fmt, ##__VA_ARGS__);   \
         |                ^~~
   include/linux/dev_printk.h:144:49: note: in expansion of macro 'dev_fmt'
     144 |  dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                                                 ^~~~~~~
   drivers/net/wireless/mediatek/mt76/mt7921/main.c:1024:3: note: in expansion of macro 'dev_err'
    1024 |   dev_err(dev->mt76.dev, "ei: %d  SSTATS_LEN: %u",
         |   ^~~~~~~
   drivers/net/wireless/mediatek/mt76/mt7921/main.c:1024:48: note: format string is defined here
    1024 |   dev_err(dev->mt76.dev, "ei: %d  SSTATS_LEN: %u",
         |                                               ~^
         |                                                |
         |                                                unsigned int
         |                                               %lu
   cc1: all warnings being treated as errors


vim +1024 drivers/net/wireless/mediatek/mt76/mt7921/main.c

   962	
   963	static
   964	void mt7921_get_et_stats(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
   965				 struct ethtool_stats *stats, u64 *data)
   966	{
   967		struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
   968		struct mt7921_phy *phy = mt7921_hw_phy(hw);
   969		struct mt7921_dev *dev = phy->dev;
   970		struct mib_stats *mib = &phy->mib;
   971		struct mt76_ethtool_worker_info wi = {
   972			.data = data,
   973			.idx = mvif->mt76.idx,
   974		};
   975		int i, ei = 0;
   976	
   977		mt7921_mutex_acquire(dev);
   978	
   979		mt7921_mac_update_mib_stats(phy);
   980	
   981		data[ei++] = mib->tx_ampdu_cnt;
   982		data[ei++] = mib->tx_mpdu_attempts_cnt;
   983		data[ei++] = mib->tx_mpdu_success_cnt;
   984		data[ei++] = mib->tx_pkt_ebf_cnt;
   985		data[ei++] = mib->tx_pkt_ibf_cnt;
   986	
   987		/* Tx ampdu stat */
   988		for (i = 0; i < 15; i++)
   989			data[ei++] = dev->mt76.aggr_stats[i];
   990	
   991		data[ei++] = phy->mib.ba_miss_cnt;
   992	
   993		/* Tx Beamformer monitor */
   994		data[ei++] = mib->tx_bf_ibf_ppdu_cnt;
   995		data[ei++] = mib->tx_bf_ebf_ppdu_cnt;
   996	
   997		/* Tx Beamformer Rx feedback monitor */
   998		data[ei++] = mib->tx_bf_rx_fb_all_cnt;
   999		data[ei++] = mib->tx_bf_rx_fb_he_cnt;
  1000		data[ei++] = mib->tx_bf_rx_fb_vht_cnt;
  1001		data[ei++] = mib->tx_bf_rx_fb_ht_cnt;
  1002	
  1003		/* Tx amsdu info (pack-count histogram) */
  1004		for (i = 0; i < ARRAY_SIZE(mib->tx_amsdu); i++)
  1005			data[ei++] = mib->tx_amsdu[i];
  1006	
  1007		/* rx counters */
  1008		data[ei++] = mib->rx_mpdu_cnt;
  1009		data[ei++] = mib->rx_ampdu_cnt;
  1010		data[ei++] = mib->rx_ampdu_bytes_cnt;
  1011		data[ei++] = mib->rx_ba_cnt;
  1012	
  1013		/* Add values for all stations owned by this vif */
  1014		wi.initial_stat_idx = ei;
  1015		ieee80211_iterate_stations_atomic(hw, mt7921_ethtool_worker, &wi);
  1016	
  1017		mt7921_mutex_release(dev);
  1018	
  1019		if (!wi.sta_count)
  1020			return;
  1021	
  1022		ei += wi.worker_stat_count;
  1023		if (ei != ARRAY_SIZE(mt7921_gstrings_stats))
> 1024			dev_err(dev->mt76.dev, "ei: %d  SSTATS_LEN: %u",
  1025				ei, ARRAY_SIZE(mt7921_gstrings_stats));
  1026	}
  1027	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
index 35a490c049e9..0b456431cb59 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
@@ -1021,7 +1021,7 @@  void mt7921_get_et_stats(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 
 	ei += wi.worker_stat_count;
 	if (ei != ARRAY_SIZE(mt7921_gstrings_stats))
-		dev_err(dev->mt76.dev, "ei: %d  SSTATS_LEN: %lu",
+		dev_err(dev->mt76.dev, "ei: %d  SSTATS_LEN: %u",
 			ei, ARRAY_SIZE(mt7921_gstrings_stats));
 }