Re: [PATCH] staging: rtl8712: Add parenthesis to Macro argument

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.2 next-20190712]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/christianluciano-m-gmail-com/staging-rtl8712-Add-parenthesis-to-Macro-argument/20190714-103146
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 7.4.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.4.0 make.cross ARCH=arm 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

   In file included from drivers/staging/rtl8712/osdep_service.h:31:0,
                    from drivers/staging/rtl8712/hal_init.c:25:
   drivers/staging/rtl8712/hal_init.c: In function 'chk_fwhdr':
   drivers/staging/rtl8712/basic_types.h:24:49: error: expected expression before ')' token
    #define FIELD_OFFSET(s, field) ((addr_t)&(((s) *)(0))->(field))
                                                    ^
>> drivers/staging/rtl8712/hal_init.c:136:12: note: in expansion of macro 'FIELD_OFFSET'
     fwhdrsz = FIELD_OFFSET(struct fw_hdr, fwpriv) + pfwhdr->fw_priv_sz;
               ^~~~~~~~~~~~
   drivers/staging/rtl8712/hal_init.c: In function 'rtl8712_dl_fw':
   drivers/staging/rtl8712/basic_types.h:24:49: error: expected expression before ')' token
    #define FIELD_OFFSET(s, field) ((addr_t)&(((s) *)(0))->(field))
                                                    ^
   drivers/staging/rtl8712/hal_init.c:176:26: note: in expansion of macro 'FIELD_OFFSET'
      ptr = (u8 *)mappedfw + FIELD_OFFSET(struct fw_hdr, fwpriv) +
                             ^~~~~~~~~~~~
--
   In file included from drivers/staging/rtl8712/osdep_service.h:31:0,
                    from drivers/staging/rtl8712/rtl871x_ioctl_linux.c:20:
   drivers/staging/rtl8712/rtl871x_ioctl_linux.c: In function 'wpa_set_encryption':
   drivers/staging/rtl8712/basic_types.h:24:49: error: expected expression before ')' token
    #define FIELD_OFFSET(s, field) ((addr_t)&(((s) *)(0))->(field))
                                                    ^
>> drivers/staging/rtl8712/rtl871x_ioctl_linux.c:413:4: note: in expansion of macro 'FIELD_OFFSET'
       FIELD_OFFSET(struct NDIS_802_11_WEP, KeyMaterial);
       ^~~~~~~~~~~~
   drivers/staging/rtl8712/rtl871x_ioctl_linux.c: In function 'r8711_wx_set_enc':
   drivers/staging/rtl8712/basic_types.h:24:49: error: expected expression before ')' token
    #define FIELD_OFFSET(s, field) ((addr_t)&(((s) *)(0))->(field))
                                                    ^
   drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1562:9: note: in expansion of macro 'FIELD_OFFSET'
            FIELD_OFFSET(struct NDIS_802_11_WEP, KeyMaterial);
            ^~~~~~~~~~~~

vim +/FIELD_OFFSET +136 drivers/staging/rtl8712/hal_init.c

359140aaea Ali Bahar          2011-09-04   24  
2865d42c78 Larry Finger       2010-08-20  @25  #include "osdep_service.h"
2865d42c78 Larry Finger       2010-08-20   26  #include "drv_types.h"
16e53729b7 Larry Finger       2010-08-30   27  #include "usb_osintf.h"
2865d42c78 Larry Finger       2010-08-20   28  
2865d42c78 Larry Finger       2010-08-20   29  #define FWBUFF_ALIGN_SZ 512
2865d42c78 Larry Finger       2010-08-20   30  #define MAX_DUMP_FWSZ	49152 /*default = 49152 (48k)*/
2865d42c78 Larry Finger       2010-08-20   31  
8c213fa591 Larry Finger       2012-02-05   32  static void rtl871x_load_fw_cb(const struct firmware *firmware, void *context)
2865d42c78 Larry Finger       2010-08-20   33  {
286570fbdf Nishka Dasgupta    2019-06-07   34  	struct _adapter *adapter = context;
8c213fa591 Larry Finger       2012-02-05   35  
286570fbdf Nishka Dasgupta    2019-06-07   36  	complete(&adapter->rtl8712_fw_ready);
8c213fa591 Larry Finger       2012-02-05   37  	if (!firmware) {
286570fbdf Nishka Dasgupta    2019-06-07   38  		struct usb_device *udev = adapter->dvobjpriv.pusbdev;
286570fbdf Nishka Dasgupta    2019-06-07   39  		struct usb_interface *usb_intf = adapter->pusb_intf;
6a7cbc38ad Sarah Khan         2014-09-24   40  
87a573ada0 Przemo Firszt      2012-12-10   41  		dev_err(&udev->dev, "r8712u: Firmware request failed\n");
8c213fa591 Larry Finger       2012-02-05   42  		usb_put_dev(udev);
286570fbdf Nishka Dasgupta    2019-06-07   43  		usb_set_intfdata(usb_intf, NULL);
8c213fa591 Larry Finger       2012-02-05   44  		return;
8c213fa591 Larry Finger       2012-02-05   45  	}
286570fbdf Nishka Dasgupta    2019-06-07   46  	adapter->fw = firmware;
8c213fa591 Larry Finger       2012-02-05   47  	/* firmware available - start netdev */
286570fbdf Nishka Dasgupta    2019-06-07   48  	register_netdev(adapter->pnetdev);
8c213fa591 Larry Finger       2012-02-05   49  }
8c213fa591 Larry Finger       2012-02-05   50  
8c213fa591 Larry Finger       2012-02-05   51  static const char firmware_file[] = "rtlwifi/rtl8712u.bin";
8c213fa591 Larry Finger       2012-02-05   52  
8c213fa591 Larry Finger       2012-02-05   53  int rtl871x_load_fw(struct _adapter *padapter)
8c213fa591 Larry Finger       2012-02-05   54  {
8c213fa591 Larry Finger       2012-02-05   55  	struct device *dev = &padapter->dvobjpriv.pusbdev->dev;
c84a7028cc Larry Finger       2011-01-14   56  	int rc;
2865d42c78 Larry Finger       2010-08-20   57  
8c213fa591 Larry Finger       2012-02-05   58  	init_completion(&padapter->rtl8712_fw_ready);
87a573ada0 Przemo Firszt      2012-12-10   59  	dev_info(dev, "r8712u: Loading firmware from \"%s\"\n", firmware_file);
8c213fa591 Larry Finger       2012-02-05   60  	rc = request_firmware_nowait(THIS_MODULE, 1, firmware_file, dev,
8c213fa591 Larry Finger       2012-02-05   61  				     GFP_KERNEL, padapter, rtl871x_load_fw_cb);
8c213fa591 Larry Finger       2012-02-05   62  	if (rc)
87a573ada0 Przemo Firszt      2012-12-10   63  		dev_err(dev, "r8712u: Firmware request error %d\n", rc);
8c213fa591 Larry Finger       2012-02-05   64  	return rc;
8c213fa591 Larry Finger       2012-02-05   65  }
8c213fa591 Larry Finger       2012-02-05   66  MODULE_FIRMWARE("rtlwifi/rtl8712u.bin");
8c213fa591 Larry Finger       2012-02-05   67  
286570fbdf Nishka Dasgupta    2019-06-07   68  static u32 rtl871x_open_fw(struct _adapter *adapter, const u8 **mappedfw)
8c213fa591 Larry Finger       2012-02-05   69  {
286570fbdf Nishka Dasgupta    2019-06-07   70  	const struct firmware **raw = &adapter->fw;
8c213fa591 Larry Finger       2012-02-05   71  
286570fbdf Nishka Dasgupta    2019-06-07   72  	if (adapter->fw->size > 200000) {
286570fbdf Nishka Dasgupta    2019-06-07   73  		dev_err(&adapter->pnetdev->dev, "r8172u: Badfw->size of %d\n",
286570fbdf Nishka Dasgupta    2019-06-07   74  			(int)adapter->fw->size);
c84a7028cc Larry Finger       2011-01-14   75  		return 0;
c84a7028cc Larry Finger       2011-01-14   76  	}
286570fbdf Nishka Dasgupta    2019-06-07   77  	*mappedfw = (*raw)->data;
286570fbdf Nishka Dasgupta    2019-06-07   78  	return (*raw)->size;
2865d42c78 Larry Finger       2010-08-20   79  }
2865d42c78 Larry Finger       2010-08-20   80  
286570fbdf Nishka Dasgupta    2019-06-07   81  static void fill_fwpriv(struct _adapter *adapter, struct fw_priv *fwpriv)
2865d42c78 Larry Finger       2010-08-20   82  {
286570fbdf Nishka Dasgupta    2019-06-07   83  	struct dvobj_priv *dvobj = &adapter->dvobjpriv;
286570fbdf Nishka Dasgupta    2019-06-07   84  	struct registry_priv *regpriv = &adapter->registrypriv;
2865d42c78 Larry Finger       2010-08-20   85  
286570fbdf Nishka Dasgupta    2019-06-07   86  	memset(fwpriv, 0, sizeof(struct fw_priv));
2865d42c78 Larry Finger       2010-08-20   87  	/* todo: check if needs endian conversion */
286570fbdf Nishka Dasgupta    2019-06-07   88  	fwpriv->hci_sel =  RTL8712_HCI_TYPE_72USB;
286570fbdf Nishka Dasgupta    2019-06-07   89  	fwpriv->usb_ep_num = (u8)dvobj->nr_endpoint;
286570fbdf Nishka Dasgupta    2019-06-07   90  	fwpriv->bw_40MHz_en = regpriv->cbw40_enable;
286570fbdf Nishka Dasgupta    2019-06-07   91  	switch (regpriv->rf_config) {
2865d42c78 Larry Finger       2010-08-20   92  	case RTL8712_RF_1T1R:
286570fbdf Nishka Dasgupta    2019-06-07   93  		fwpriv->rf_config = RTL8712_RFC_1T1R;
2865d42c78 Larry Finger       2010-08-20   94  		break;
2865d42c78 Larry Finger       2010-08-20   95  	case RTL8712_RF_2T2R:
286570fbdf Nishka Dasgupta    2019-06-07   96  		fwpriv->rf_config = RTL8712_RFC_2T2R;
2865d42c78 Larry Finger       2010-08-20   97  		break;
2865d42c78 Larry Finger       2010-08-20   98  	case RTL8712_RF_1T2R:
2865d42c78 Larry Finger       2010-08-20   99  	default:
286570fbdf Nishka Dasgupta    2019-06-07  100  		fwpriv->rf_config = RTL8712_RFC_1T2R;
2865d42c78 Larry Finger       2010-08-20  101  	}
286570fbdf Nishka Dasgupta    2019-06-07  102  	fwpriv->mp_mode = (regpriv->mp_mode == 1) ? 1 : 0;
a77a40cf8b Bhagyashri Dighole 2019-03-12  103  	/* 0:off 1:on 2:auto */
286570fbdf Nishka Dasgupta    2019-06-07  104  	fwpriv->vcs_type = regpriv->vrtl_carrier_sense;
286570fbdf Nishka Dasgupta    2019-06-07  105  	fwpriv->vcs_mode = regpriv->vcs_type; /* 1:RTS/CTS 2:CTS to self */
365b01638c Robert Eshleman    2018-10-27  106  	/* default enable turbo_mode */
286570fbdf Nishka Dasgupta    2019-06-07  107  	fwpriv->turbo_mode = ((regpriv->wifi_test == 1) ? 0 : 1);
286570fbdf Nishka Dasgupta    2019-06-07  108  	fwpriv->low_power_mode = regpriv->low_power;
2865d42c78 Larry Finger       2010-08-20  109  }
2865d42c78 Larry Finger       2010-08-20  110  
2865d42c78 Larry Finger       2010-08-20  111  static void update_fwhdr(struct fw_hdr	*pfwhdr, const u8 *pmappedfw)
2865d42c78 Larry Finger       2010-08-20  112  {
aa2e04bcdd Jannik Becher      2016-12-20  113  	pfwhdr->signature = le16_to_cpu(*(__le16 *)pmappedfw);
aa2e04bcdd Jannik Becher      2016-12-20  114  	pfwhdr->version = le16_to_cpu(*(__le16 *)(pmappedfw + 2));
2865d42c78 Larry Finger       2010-08-20  115  	/* define the size of boot loader */
aa2e04bcdd Jannik Becher      2016-12-20  116  	pfwhdr->dmem_size = le32_to_cpu(*(__le32 *)(pmappedfw + 4));
2865d42c78 Larry Finger       2010-08-20  117  	/* define the size of FW in IMEM */
aa2e04bcdd Jannik Becher      2016-12-20  118  	pfwhdr->img_IMEM_size = le32_to_cpu(*(__le32 *)(pmappedfw + 8));
2865d42c78 Larry Finger       2010-08-20  119  	/* define the size of FW in SRAM */
aa2e04bcdd Jannik Becher      2016-12-20  120  	pfwhdr->img_SRAM_size = le32_to_cpu(*(__le32 *)(pmappedfw + 12));
2865d42c78 Larry Finger       2010-08-20  121  	/* define the size of DMEM variable */
aa2e04bcdd Jannik Becher      2016-12-20  122  	pfwhdr->fw_priv_sz = le32_to_cpu(*(__le32 *)(pmappedfw + 16));
2865d42c78 Larry Finger       2010-08-20  123  }
2865d42c78 Larry Finger       2010-08-20  124  
2865d42c78 Larry Finger       2010-08-20  125  static u8 chk_fwhdr(struct fw_hdr *pfwhdr, u32 ulfilelength)
2865d42c78 Larry Finger       2010-08-20  126  {
2865d42c78 Larry Finger       2010-08-20  127  	u32	fwhdrsz, fw_sz;
2865d42c78 Larry Finger       2010-08-20  128  
2865d42c78 Larry Finger       2010-08-20  129  	/* check signature */
2865d42c78 Larry Finger       2010-08-20  130  	if ((pfwhdr->signature != 0x8712) && (pfwhdr->signature != 0x8192))
2865d42c78 Larry Finger       2010-08-20  131  		return _FAIL;
2865d42c78 Larry Finger       2010-08-20  132  	/* check fw_priv_sze & sizeof(struct fw_priv) */
2865d42c78 Larry Finger       2010-08-20  133  	if (pfwhdr->fw_priv_sz != sizeof(struct fw_priv))
2865d42c78 Larry Finger       2010-08-20  134  		return _FAIL;
2865d42c78 Larry Finger       2010-08-20  135  	/* check fw_sz & image_fw_sz */
2865d42c78 Larry Finger       2010-08-20 @136  	fwhdrsz = FIELD_OFFSET(struct fw_hdr, fwpriv) + pfwhdr->fw_priv_sz;
2865d42c78 Larry Finger       2010-08-20  137  	fw_sz =  fwhdrsz + pfwhdr->img_IMEM_size + pfwhdr->img_SRAM_size +
2865d42c78 Larry Finger       2010-08-20  138  		 pfwhdr->dmem_size;
2865d42c78 Larry Finger       2010-08-20  139  	if (fw_sz != ulfilelength)
2865d42c78 Larry Finger       2010-08-20  140  		return _FAIL;
2865d42c78 Larry Finger       2010-08-20  141  	return _SUCCESS;
2865d42c78 Larry Finger       2010-08-20  142  }
2865d42c78 Larry Finger       2010-08-20  143  

:::::: The code at line 136 was first introduced by commit
:::::: 2865d42c78a9121caad52cb02d1fbb7f5cdbc4ef staging: r8712u: Add the new driver to the mainline kernel

:::::: TO: Larry Finger <Larry.Finger@xxxxxxxxxxxx>
:::::: CC: Larry Finger <Larry.Finger@xxxxxxxxxxxx>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux