[PATCH] ath11k: use min() to make code cleaner

kernel test robot lkp at intel.com
Mon Dec 20 09:12:15 PST 2021


Hi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on kvalo-ath/ath-next]
[also build test WARNING on v5.16-rc6 next-20211220]
[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/cgel-zte-gmail-com/ath11k-use-min-to-make-code-cleaner/20211220-192326
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git ath-next
config: hexagon-randconfig-r001-20211220 (https://download.01.org/0day-ci/archive/20211221/202112210104.cbWjNxoN-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 555eacf75f21cd1dfc6363d73ad187b730349543)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/526b459a20794d7325764c3fea5fd3e0521d6084
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review cgel-zte-gmail-com/ath11k-use-min-to-make-code-cleaner/20211220-192326
        git checkout 526b459a20794d7325764c3fea5fd3e0521d6084
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/net/wireless/ath/ath11k/

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

All warnings (new ones prefixed by >>):

>> drivers/net/wireless/ath/ath11k/wmi.c:617:12: warning: comparison of distinct pointer types ('typeof (frame->len) *' (aka 'unsigned int *') and 'typeof (64) *' (aka 'int *')) [-Wcompare-distinct-pointer-types]
           buf_len = min(frame->len, WMI_MGMT_SEND_DOWNLD_LEN);
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:45:19: note: expanded from macro 'min'
   #define min(x, y)       __careful_cmp(x, y, <)
                           ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:36:24: note: expanded from macro '__careful_cmp'
           __builtin_choose_expr(__safe_cmp(x, y), \
                                 ^~~~~~~~~~~~~~~~
   include/linux/minmax.h:26:4: note: expanded from macro '__safe_cmp'
                   (__typecheck(x, y) && __no_side_effects(x, y))
                    ^~~~~~~~~~~~~~~~~
   include/linux/minmax.h:20:28: note: expanded from macro '__typecheck'
           (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                      ~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~
   1 warning generated.


vim +617 drivers/net/wireless/ath/ath11k/wmi.c

   606	
   607	int ath11k_wmi_mgmt_send(struct ath11k *ar, u32 vdev_id, u32 buf_id,
   608				 struct sk_buff *frame)
   609	{
   610		struct ath11k_pdev_wmi *wmi = ar->wmi;
   611		struct wmi_mgmt_send_cmd *cmd;
   612		struct wmi_tlv *frame_tlv;
   613		struct sk_buff *skb;
   614		u32 buf_len;
   615		int ret, len;
   616	
 > 617		buf_len = min(frame->len, WMI_MGMT_SEND_DOWNLD_LEN);
   618	
   619		len = sizeof(*cmd) + sizeof(*frame_tlv) + roundup(buf_len, 4);
   620	
   621		skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, len);
   622		if (!skb)
   623			return -ENOMEM;
   624	
   625		cmd = (struct wmi_mgmt_send_cmd *)skb->data;
   626		cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_MGMT_TX_SEND_CMD) |
   627				  FIELD_PREP(WMI_TLV_LEN, sizeof(*cmd) - TLV_HDR_SIZE);
   628		cmd->vdev_id = vdev_id;
   629		cmd->desc_id = buf_id;
   630		cmd->chanfreq = 0;
   631		cmd->paddr_lo = lower_32_bits(ATH11K_SKB_CB(frame)->paddr);
   632		cmd->paddr_hi = upper_32_bits(ATH11K_SKB_CB(frame)->paddr);
   633		cmd->frame_len = frame->len;
   634		cmd->buf_len = buf_len;
   635		cmd->tx_params_valid = 0;
   636	
   637		frame_tlv = (struct wmi_tlv *)(skb->data + sizeof(*cmd));
   638		frame_tlv->header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_ARRAY_BYTE) |
   639				    FIELD_PREP(WMI_TLV_LEN, buf_len);
   640	
   641		memcpy(frame_tlv->value, frame->data, buf_len);
   642	
   643		ath11k_ce_byte_swap(frame_tlv->value, buf_len);
   644	
   645		ret = ath11k_wmi_cmd_send(wmi, skb, WMI_MGMT_TX_SEND_CMDID);
   646		if (ret) {
   647			ath11k_warn(ar->ab,
   648				    "failed to submit WMI_MGMT_TX_SEND_CMDID cmd\n");
   649			dev_kfree_skb(skb);
   650		}
   651	
   652		return ret;
   653	}
   654	

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



More information about the ath11k mailing list