[PATCH] saa7164: Fix driver name in debug output

2018-05-02 Thread Brad Love
This issue was reported by a user who downloaded a corrupt saa7164
firmware, then went looking for a valid xc5000 firmware to fix the
error displayed...but the device in question has no xc5000, thus after
much effort, the wild goose chase eventually led to a support call.

The xc5000 has nothing to do with saa7164 (as far as I can tell),
so replace the string with saa7164 as well as give a meaningful
hint on the firmware mismatch.

Signed-off-by: Brad Love 
---
 drivers/media/pci/saa7164/saa7164-fw.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/pci/saa7164/saa7164-fw.c 
b/drivers/media/pci/saa7164/saa7164-fw.c
index ef49064..ee65ea8 100644
--- a/drivers/media/pci/saa7164/saa7164-fw.c
+++ b/drivers/media/pci/saa7164/saa7164-fw.c
@@ -426,7 +426,8 @@ int saa7164_downloadfirmware(struct saa7164_dev *dev)
__func__, fw->size);
 
if (fw->size != fwlength) {
-   printk(KERN_ERR "xc5000: firmware incorrect size\n");
+   printk(KERN_ERR "saa7164: firmware incorrect size %d != 
%d\n",
+   fw->size, fwlength);
ret = -ENOMEM;
goto out;
}
-- 
2.7.4



Re: [PATCH] saa7164: Fix driver name in debug output

2018-05-03 Thread kbuild test robot
Hi Brad,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on v4.17-rc3 next-20180502]
[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/Brad-Love/saa7164-Fix-driver-name-in-debug-output/20180503-133636
base:   git://linuxtv.org/media_tree.git master
config: sparc64-allmodconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.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
make.cross ARCH=sparc64 

All warnings (new ones prefixed by >>):

   In file included from include/linux/printk.h:7:0,
from include/linux/kernel.h:14,
from include/asm-generic/bug.h:18,
from arch/sparc/include/asm/bug.h:25,
from include/linux/bug.h:5,
from include/linux/mmdebug.h:5,
from include/linux/gfp.h:5,
from include/linux/firmware.h:7,
from drivers/media//pci/saa7164/saa7164-fw.c:18:
   drivers/media//pci/saa7164/saa7164-fw.c: In function 
'saa7164_downloadfirmware':
   include/linux/kern_levels.h:5:18: warning: format '%d' expects argument of 
type 'int', but argument 2 has type 'size_t {aka const long unsigned int}' 
[-Wformat=]
#define KERN_SOH "\001"  /* ASCII Start Of Header */
 ^
   include/linux/kern_levels.h:11:18: note: in expansion of macro 'KERN_SOH'
#define KERN_ERR KERN_SOH "3" /* error conditions */
 ^~~~
>> drivers/media//pci/saa7164/saa7164-fw.c:429:11: note: in expansion of macro 
>> 'KERN_ERR'
   printk(KERN_ERR "saa7164: firmware incorrect size %d != %d\n",
  ^~~~
   drivers/media//pci/saa7164/saa7164-fw.c:429:55: note: format string is 
defined here
   printk(KERN_ERR "saa7164: firmware incorrect size %d != %d\n",
 ~^
 %ld

vim +/KERN_ERR +429 drivers/media//pci/saa7164/saa7164-fw.c

   195  
   196  /* TODO: Excessive debug */
   197  /* Load the firmware. Optionally it can be in ROM or newer versions
   198   * can be on disk, saving the expense of the ROM hardware. */
   199  int saa7164_downloadfirmware(struct saa7164_dev *dev)
   200  {
   201  /* u32 second_timeout = 60 * SAA_DEVICE_TIMEOUT; */
   202  u32 tmp, filesize, version, err_flags, first_timeout, fwlength;
   203  u32 second_timeout, updatebootloader = 1, bootloadersize = 0;
   204  const struct firmware *fw = NULL;
   205  struct fw_header *hdr, *boothdr = NULL, *fwhdr;
   206  u32 bootloaderversion = 0, fwloadersize;
   207  u8 *bootloaderoffset = NULL, *fwloaderoffset;
   208  char *fwname;
   209  int ret;
   210  
   211  dprintk(DBGLVL_FW, "%s()\n", __func__);
   212  
   213  if (saa7164_boards[dev->board].chiprev == SAA7164_CHIP_REV2) {
   214  fwname = SAA7164_REV2_FIRMWARE;
   215  fwlength = SAA7164_REV2_FIRMWARE_SIZE;
   216  } else {
   217  fwname = SAA7164_REV3_FIRMWARE;
   218  fwlength = SAA7164_REV3_FIRMWARE_SIZE;
   219  }
   220  
   221  version = saa7164_getcurrentfirmwareversion(dev);
   222  
   223  if (version == 0x00) {
   224  
   225  second_timeout = 100;
   226  first_timeout = 100;
   227  err_flags = saa7164_readl(SAA_BOOTLOADERERROR_FLAGS);
   228  dprintk(DBGLVL_FW, "%s() err_flags = %x\n",
   229  __func__, err_flags);
   230  
   231  while (err_flags != SAA_DEVICE_IMAGE_BOOTING) {
   232  dprintk(DBGLVL_FW, "%s() err_flags = %x\n",
   233  __func__, err_flags);
   234  msleep(10); /* Checkpatch throws a < 20ms 
warning */
   235  
   236  if (err_flags & SAA_DEVICE_IMAGE_CORRUPT) {
   237  printk(KERN_ERR "%s() firmware 
corrupt\n",
   238  __func__);
   239  break;
   240  }
   241  if (err_flags & SAA_DEVICE_MEMORY_CORRUPT) {
   242  printk(KERN_ERR "%s() device memory 
corrupt\n",
   243  __func__);
   244  break;
   245  }
   246  if (err_flags & SAA_DEVICE_NO_IMAGE) {
   247