Re: [PATCH v2 06/15] usb: misc: emi62: update to use usb_control_msg_send()

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

 



Hi Anant,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on usb/usb-testing]
[also build test WARNING on balbi-usb/testing/next peter.chen-usb/ci-for-usb-next v5.10-rc6 next-20201127]
[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/Anant-Thazhemadam/drivers-usb-misc-update-to-use-usb_control_msg_-send-recv/20201130-093816
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: h8300-randconfig-s032-20201130 (attached as .config)
compiler: h8300-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-170-g3bc348f6-dirty
        # https://github.com/0day-ci/linux/commit/a9e2333efa48de6856185ec35c82b659ff1c1215
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Anant-Thazhemadam/drivers-usb-misc-update-to-use-usb_control_msg_-send-recv/20201130-093816
        git checkout a9e2333efa48de6856185ec35c82b659ff1c1215
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=h8300 

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

All warnings (new ones prefixed by >>):

   drivers/usb/misc/emi62.c: In function 'emi62_load_firmware':
>> drivers/usb/misc/emi62.c:213:1: warning: the frame size of 1048 bytes is larger than 1024 bytes [-Wframe-larger-than=]
     213 | }
         | ^

vim +213 drivers/usb/misc/emi62.c

^1da177e4c3f415 Linus Torvalds     2005-04-16   68  
^1da177e4c3f415 Linus Torvalds     2005-04-16   69  static int emi62_load_firmware (struct usb_device *dev)
^1da177e4c3f415 Linus Torvalds     2005-04-16   70  {
b8e24bfabb03527 David Woodhouse    2008-05-30   71  	const struct firmware *loader_fw = NULL;
b8e24bfabb03527 David Woodhouse    2008-05-30   72  	const struct firmware *bitstream_fw = NULL;
b8e24bfabb03527 David Woodhouse    2008-05-30   73  	const struct firmware *firmware_fw = NULL;
b8e24bfabb03527 David Woodhouse    2008-05-30   74  	const struct ihex_binrec *rec;
e9a527dae346c0a Greg Kroah-Hartman 2012-04-20   75  	int err = -ENOMEM;
^1da177e4c3f415 Linus Torvalds     2005-04-16   76  	int i;
^1da177e4c3f415 Linus Torvalds     2005-04-16   77  	__u32 addr;	/* Address to write */
a9e2333efa48de6 Anant Thazhemadam  2020-11-30   78  	__u8 buf[FW_LOAD_SIZE];
^1da177e4c3f415 Linus Torvalds     2005-04-16   79  
^1da177e4c3f415 Linus Torvalds     2005-04-16   80  	dev_dbg(&dev->dev, "load_firmware\n");
^1da177e4c3f415 Linus Torvalds     2005-04-16   81  
b8e24bfabb03527 David Woodhouse    2008-05-30   82  	err = request_ihex_firmware(&loader_fw, "emi62/loader.fw", &dev->dev);
b8e24bfabb03527 David Woodhouse    2008-05-30   83  	if (err)
b8e24bfabb03527 David Woodhouse    2008-05-30   84  		goto nofw;
b8e24bfabb03527 David Woodhouse    2008-05-30   85  
b8e24bfabb03527 David Woodhouse    2008-05-30   86  	err = request_ihex_firmware(&bitstream_fw, "emi62/bitstream.fw",
b8e24bfabb03527 David Woodhouse    2008-05-30   87  				    &dev->dev);
b8e24bfabb03527 David Woodhouse    2008-05-30   88  	if (err)
b8e24bfabb03527 David Woodhouse    2008-05-30   89  		goto nofw;
b8e24bfabb03527 David Woodhouse    2008-05-30   90  
b8e24bfabb03527 David Woodhouse    2008-05-30   91  	err = request_ihex_firmware(&firmware_fw, FIRMWARE_FW, &dev->dev);
b8e24bfabb03527 David Woodhouse    2008-05-30   92  	if (err) {
b8e24bfabb03527 David Woodhouse    2008-05-30   93  	nofw:
b8e24bfabb03527 David Woodhouse    2008-05-30   94  		goto wraperr;
b8e24bfabb03527 David Woodhouse    2008-05-30   95  	}
b8e24bfabb03527 David Woodhouse    2008-05-30   96  
^1da177e4c3f415 Linus Torvalds     2005-04-16   97  	/* Assert reset (stop the CPU in the EMI) */
^1da177e4c3f415 Linus Torvalds     2005-04-16   98  	err = emi62_set_reset(dev,1);
e9a527dae346c0a Greg Kroah-Hartman 2012-04-20   99  	if (err < 0)
^1da177e4c3f415 Linus Torvalds     2005-04-16  100  		goto wraperr;
^1da177e4c3f415 Linus Torvalds     2005-04-16  101  
b8e24bfabb03527 David Woodhouse    2008-05-30  102  	rec = (const struct ihex_binrec *)loader_fw->data;
b8e24bfabb03527 David Woodhouse    2008-05-30  103  
^1da177e4c3f415 Linus Torvalds     2005-04-16  104  	/* 1. We need to put the loader for the FPGA into the EZ-USB */
b8e24bfabb03527 David Woodhouse    2008-05-30  105  	while (rec) {
b8e24bfabb03527 David Woodhouse    2008-05-30  106  		err = emi62_writememory(dev, be32_to_cpu(rec->addr),
b8e24bfabb03527 David Woodhouse    2008-05-30  107  					rec->data, be16_to_cpu(rec->len),
b8e24bfabb03527 David Woodhouse    2008-05-30  108  					ANCHOR_LOAD_INTERNAL);
e9a527dae346c0a Greg Kroah-Hartman 2012-04-20  109  		if (err < 0)
^1da177e4c3f415 Linus Torvalds     2005-04-16  110  			goto wraperr;
b8e24bfabb03527 David Woodhouse    2008-05-30  111  		rec = ihex_next_binrec(rec);
^1da177e4c3f415 Linus Torvalds     2005-04-16  112  	}
^1da177e4c3f415 Linus Torvalds     2005-04-16  113  
^1da177e4c3f415 Linus Torvalds     2005-04-16  114  	/* De-assert reset (let the CPU run) */
^1da177e4c3f415 Linus Torvalds     2005-04-16  115  	err = emi62_set_reset(dev,0);
e9a527dae346c0a Greg Kroah-Hartman 2012-04-20  116  	if (err < 0)
5919a43bbc649f4 Oliver Neukum      2007-10-25  117  		goto wraperr;
16c23f7d88cbcce Monty              2006-05-09  118  	msleep(250);	/* let device settle */
^1da177e4c3f415 Linus Torvalds     2005-04-16  119  
^1da177e4c3f415 Linus Torvalds     2005-04-16  120  	/* 2. We upload the FPGA firmware into the EMI
^1da177e4c3f415 Linus Torvalds     2005-04-16  121  	 * Note: collect up to 1023 (yes!) bytes and send them with
^1da177e4c3f415 Linus Torvalds     2005-04-16  122  	 * a single request. This is _much_ faster! */
b8e24bfabb03527 David Woodhouse    2008-05-30  123  	rec = (const struct ihex_binrec *)bitstream_fw->data;
^1da177e4c3f415 Linus Torvalds     2005-04-16  124  	do {
^1da177e4c3f415 Linus Torvalds     2005-04-16  125  		i = 0;
b8e24bfabb03527 David Woodhouse    2008-05-30  126  		addr = be32_to_cpu(rec->addr);
^1da177e4c3f415 Linus Torvalds     2005-04-16  127  
^1da177e4c3f415 Linus Torvalds     2005-04-16  128  		/* intel hex records are terminated with type 0 element */
b8e24bfabb03527 David Woodhouse    2008-05-30  129  		while (rec && (i + be16_to_cpu(rec->len) < FW_LOAD_SIZE)) {
a9e2333efa48de6 Anant Thazhemadam  2020-11-30  130  			memcpy(&buf[i], rec->data, be16_to_cpu(rec->len));
b8e24bfabb03527 David Woodhouse    2008-05-30  131  			i += be16_to_cpu(rec->len);
b8e24bfabb03527 David Woodhouse    2008-05-30  132  			rec = ihex_next_binrec(rec);
^1da177e4c3f415 Linus Torvalds     2005-04-16  133  		}
a9e2333efa48de6 Anant Thazhemadam  2020-11-30  134  		err = emi62_writememory(dev, addr, &buf, i, ANCHOR_LOAD_FPGA);
e9a527dae346c0a Greg Kroah-Hartman 2012-04-20  135  		if (err < 0)
^1da177e4c3f415 Linus Torvalds     2005-04-16  136  			goto wraperr;
ac06c06770bb876 Clemens Ladisch    2009-12-21  137  	} while (rec);
^1da177e4c3f415 Linus Torvalds     2005-04-16  138  
^1da177e4c3f415 Linus Torvalds     2005-04-16  139  	/* Assert reset (stop the CPU in the EMI) */
^1da177e4c3f415 Linus Torvalds     2005-04-16  140  	err = emi62_set_reset(dev,1);
e9a527dae346c0a Greg Kroah-Hartman 2012-04-20  141  	if (err < 0)
^1da177e4c3f415 Linus Torvalds     2005-04-16  142  		goto wraperr;
^1da177e4c3f415 Linus Torvalds     2005-04-16  143  
^1da177e4c3f415 Linus Torvalds     2005-04-16  144  	/* 3. We need to put the loader for the firmware into the EZ-USB (again...) */
b8e24bfabb03527 David Woodhouse    2008-05-30  145  	for (rec = (const struct ihex_binrec *)loader_fw->data;
b8e24bfabb03527 David Woodhouse    2008-05-30  146  	     rec; rec = ihex_next_binrec(rec)) {
b8e24bfabb03527 David Woodhouse    2008-05-30  147  		err = emi62_writememory(dev, be32_to_cpu(rec->addr),
b8e24bfabb03527 David Woodhouse    2008-05-30  148  					rec->data, be16_to_cpu(rec->len),
b8e24bfabb03527 David Woodhouse    2008-05-30  149  					ANCHOR_LOAD_INTERNAL);
e9a527dae346c0a Greg Kroah-Hartman 2012-04-20  150  		if (err < 0)
^1da177e4c3f415 Linus Torvalds     2005-04-16  151  			goto wraperr;
^1da177e4c3f415 Linus Torvalds     2005-04-16  152  	}
^1da177e4c3f415 Linus Torvalds     2005-04-16  153  
^1da177e4c3f415 Linus Torvalds     2005-04-16  154  	/* De-assert reset (let the CPU run) */
^1da177e4c3f415 Linus Torvalds     2005-04-16  155  	err = emi62_set_reset(dev,0);
e9a527dae346c0a Greg Kroah-Hartman 2012-04-20  156  	if (err < 0)
^1da177e4c3f415 Linus Torvalds     2005-04-16  157  		goto wraperr;
16c23f7d88cbcce Monty              2006-05-09  158  	msleep(250);	/* let device settle */
^1da177e4c3f415 Linus Torvalds     2005-04-16  159  
^1da177e4c3f415 Linus Torvalds     2005-04-16  160  	/* 4. We put the part of the firmware that lies in the external RAM into the EZ-USB */
^1da177e4c3f415 Linus Torvalds     2005-04-16  161  
b8e24bfabb03527 David Woodhouse    2008-05-30  162  	for (rec = (const struct ihex_binrec *)firmware_fw->data;
b8e24bfabb03527 David Woodhouse    2008-05-30  163  	     rec; rec = ihex_next_binrec(rec)) {
b8e24bfabb03527 David Woodhouse    2008-05-30  164  		if (!INTERNAL_RAM(be32_to_cpu(rec->addr))) {
b8e24bfabb03527 David Woodhouse    2008-05-30  165  			err = emi62_writememory(dev, be32_to_cpu(rec->addr),
b8e24bfabb03527 David Woodhouse    2008-05-30  166  						rec->data, be16_to_cpu(rec->len),
b8e24bfabb03527 David Woodhouse    2008-05-30  167  						ANCHOR_LOAD_EXTERNAL);
e9a527dae346c0a Greg Kroah-Hartman 2012-04-20  168  			if (err < 0)
^1da177e4c3f415 Linus Torvalds     2005-04-16  169  				goto wraperr;
^1da177e4c3f415 Linus Torvalds     2005-04-16  170  		}
^1da177e4c3f415 Linus Torvalds     2005-04-16  171  	}
b8e24bfabb03527 David Woodhouse    2008-05-30  172  
^1da177e4c3f415 Linus Torvalds     2005-04-16  173  	/* Assert reset (stop the CPU in the EMI) */
^1da177e4c3f415 Linus Torvalds     2005-04-16  174  	err = emi62_set_reset(dev,1);
e9a527dae346c0a Greg Kroah-Hartman 2012-04-20  175  	if (err < 0)
^1da177e4c3f415 Linus Torvalds     2005-04-16  176  		goto wraperr;
^1da177e4c3f415 Linus Torvalds     2005-04-16  177  
b8e24bfabb03527 David Woodhouse    2008-05-30  178  	for (rec = (const struct ihex_binrec *)firmware_fw->data;
b8e24bfabb03527 David Woodhouse    2008-05-30  179  	     rec; rec = ihex_next_binrec(rec)) {
b8e24bfabb03527 David Woodhouse    2008-05-30  180  		if (INTERNAL_RAM(be32_to_cpu(rec->addr))) {
b8e24bfabb03527 David Woodhouse    2008-05-30  181  			err = emi62_writememory(dev, be32_to_cpu(rec->addr),
b8e24bfabb03527 David Woodhouse    2008-05-30  182  						rec->data, be16_to_cpu(rec->len),
b8e24bfabb03527 David Woodhouse    2008-05-30  183  						ANCHOR_LOAD_EXTERNAL);
e9a527dae346c0a Greg Kroah-Hartman 2012-04-20  184  			if (err < 0)
^1da177e4c3f415 Linus Torvalds     2005-04-16  185  				goto wraperr;
^1da177e4c3f415 Linus Torvalds     2005-04-16  186  		}
^1da177e4c3f415 Linus Torvalds     2005-04-16  187  	}
^1da177e4c3f415 Linus Torvalds     2005-04-16  188  
^1da177e4c3f415 Linus Torvalds     2005-04-16  189  	/* De-assert reset (let the CPU run) */
^1da177e4c3f415 Linus Torvalds     2005-04-16  190  	err = emi62_set_reset(dev,0);
e9a527dae346c0a Greg Kroah-Hartman 2012-04-20  191  	if (err < 0)
^1da177e4c3f415 Linus Torvalds     2005-04-16  192  		goto wraperr;
16c23f7d88cbcce Monty              2006-05-09  193  	msleep(250);	/* let device settle */
^1da177e4c3f415 Linus Torvalds     2005-04-16  194  
b8e24bfabb03527 David Woodhouse    2008-05-30  195  	release_firmware(loader_fw);
b8e24bfabb03527 David Woodhouse    2008-05-30  196  	release_firmware(bitstream_fw);
b8e24bfabb03527 David Woodhouse    2008-05-30  197  	release_firmware(firmware_fw);
b8e24bfabb03527 David Woodhouse    2008-05-30  198  
^1da177e4c3f415 Linus Torvalds     2005-04-16  199  	/* return 1 to fail the driver inialization
^1da177e4c3f415 Linus Torvalds     2005-04-16  200  	 * and give real driver change to load */
^1da177e4c3f415 Linus Torvalds     2005-04-16  201  	return 1;
^1da177e4c3f415 Linus Torvalds     2005-04-16  202  
^1da177e4c3f415 Linus Torvalds     2005-04-16  203  wraperr:
e9a527dae346c0a Greg Kroah-Hartman 2012-04-20  204  	if (err < 0)
e9a527dae346c0a Greg Kroah-Hartman 2012-04-20  205  		dev_err(&dev->dev,"%s - error loading firmware: error = %d\n",
e9a527dae346c0a Greg Kroah-Hartman 2012-04-20  206  			__func__, err);
b8e24bfabb03527 David Woodhouse    2008-05-30  207  	release_firmware(loader_fw);
b8e24bfabb03527 David Woodhouse    2008-05-30  208  	release_firmware(bitstream_fw);
b8e24bfabb03527 David Woodhouse    2008-05-30  209  	release_firmware(firmware_fw);
b8e24bfabb03527 David Woodhouse    2008-05-30  210  
^1da177e4c3f415 Linus Torvalds     2005-04-16  211  	dev_err(&dev->dev, "Error\n");
^1da177e4c3f415 Linus Torvalds     2005-04-16  212  	return err;
^1da177e4c3f415 Linus Torvalds     2005-04-16 @213  }
^1da177e4c3f415 Linus Torvalds     2005-04-16  214  

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux