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-20180504]
[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/20180504-114908
base:   git://linuxtv.org/media_tree.git master
config: i386-allyesconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/media/pci/saa7164/saa7164-fw.c: In function 
'saa7164_downloadfirmware':
>> drivers/media/pci/saa7164/saa7164-fw.c:429:11: warning: format '%ld' expects 
>> argument of type 'long int', but argument 2 has type 'size_t {aka const 
>> unsigned int}' [-Wformat=]
       printk(KERN_ERR "saa7164: firmware incorrect size %ld != %u\n",
              ^~~~~~
        fw->size, fwlength);
        ~~~~~~~~

vim +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                                  printk(KERN_ERR "%s() no first image\n",
   248                                  __func__);
   249                                  break;
   250                          }
   251                          if (err_flags & SAA_DEVICE_IMAGE_SEARCHING) {
   252                                  first_timeout -= 10;
   253                                  if (first_timeout == 0) {
   254                                          printk(KERN_ERR
   255                                                  "%s() no first image\n",
   256                                                  __func__);
   257                                          break;
   258                                  }
   259                          } else if (err_flags & 
SAA_DEVICE_IMAGE_LOADING) {
   260                                  second_timeout -= 10;
   261                                  if (second_timeout == 0) {
   262                                          printk(KERN_ERR
   263                                          "%s() FW load time exceeded\n",
   264                                                  __func__);
   265                                          break;
   266                                  }
   267                          } else {
   268                                  second_timeout -= 10;
   269                                  if (second_timeout == 0) {
   270                                          printk(KERN_ERR
   271                                          "%s() Unknown bootloader flags 
0x%x\n",
   272                                                  __func__, err_flags);
   273                                          break;
   274                                  }
   275                          }
   276  
   277                          err_flags = 
saa7164_readl(SAA_BOOTLOADERERROR_FLAGS);
   278                  } /* While != Booting */
   279  
   280                  if (err_flags == SAA_DEVICE_IMAGE_BOOTING) {
   281                          dprintk(DBGLVL_FW, "%s() Loader 1 has 
loaded.\n",
   282                                  __func__);
   283                          first_timeout = SAA_DEVICE_TIMEOUT;
   284                          second_timeout = 60 * SAA_DEVICE_TIMEOUT;
   285                          second_timeout = 100;
   286  
   287                          err_flags = 
saa7164_readl(SAA_SECONDSTAGEERROR_FLAGS);
   288                          dprintk(DBGLVL_FW, "%s() err_flags2 = %x\n",
   289                                  __func__, err_flags);
   290                          while (err_flags != SAA_DEVICE_IMAGE_BOOTING) {
   291                                  dprintk(DBGLVL_FW, "%s() err_flags2 = 
%x\n",
   292                                          __func__, err_flags);
   293                                  msleep(10); /* Checkpatch throws a < 
20ms warning */
   294  
   295                                  if (err_flags & 
SAA_DEVICE_IMAGE_CORRUPT) {
   296                                          printk(KERN_ERR
   297                                                  "%s() firmware 
corrupt\n",
   298                                                  __func__);
   299                                          break;
   300                                  }
   301                                  if (err_flags & 
SAA_DEVICE_MEMORY_CORRUPT) {
   302                                          printk(KERN_ERR
   303                                                  "%s() device memory 
corrupt\n",
   304                                                  __func__);
   305                                          break;
   306                                  }
   307                                  if (err_flags & SAA_DEVICE_NO_IMAGE) {
   308                                          printk(KERN_ERR "%s() no second 
image\n",
   309                                                  __func__);
   310                                          break;
   311                                  }
   312                                  if (err_flags & 
SAA_DEVICE_IMAGE_SEARCHING) {
   313                                          first_timeout -= 10;
   314                                          if (first_timeout == 0) {
   315                                                  printk(KERN_ERR
   316                                                  "%s() no second 
image\n",
   317                                                          __func__);
   318                                                  break;
   319                                          }
   320                                  } else if (err_flags &
   321                                          SAA_DEVICE_IMAGE_LOADING) {
   322                                          second_timeout -= 10;
   323                                          if (second_timeout == 0) {
   324                                                  printk(KERN_ERR
   325                                                  "%s() FW load time 
exceeded\n",
   326                                                          __func__);
   327                                                  break;
   328                                          }
   329                                  } else {
   330                                          second_timeout -= 10;
   331                                          if (second_timeout == 0) {
   332                                                  printk(KERN_ERR
   333                                          "%s() Unknown bootloader flags 
0x%x\n",
   334                                                          __func__, 
err_flags);
   335                                                  break;
   336                                          }
   337                                  }
   338  
   339                                  err_flags =
   340                                  
saa7164_readl(SAA_SECONDSTAGEERROR_FLAGS);
   341                          } /* err_flags != SAA_DEVICE_IMAGE_BOOTING */
   342  
   343                          dprintk(DBGLVL_FW, "%s() Loader flags 1:0x%x 
2:0x%x.\n",
   344                                  __func__,
   345                                  
saa7164_readl(SAA_BOOTLOADERERROR_FLAGS),
   346                                  
saa7164_readl(SAA_SECONDSTAGEERROR_FLAGS));
   347  
   348                  } /* err_flags == SAA_DEVICE_IMAGE_BOOTING */
   349  
   350                  /* It's possible for both firmwares to have booted,
   351                   * but that doesn't mean they've finished booting yet.
   352                   */
   353                  if ((saa7164_readl(SAA_BOOTLOADERERROR_FLAGS) ==
   354                          SAA_DEVICE_IMAGE_BOOTING) &&
   355                          (saa7164_readl(SAA_SECONDSTAGEERROR_FLAGS) ==
   356                          SAA_DEVICE_IMAGE_BOOTING)) {
   357  
   358  
   359                          dprintk(DBGLVL_FW, "%s() Loader 2 has 
loaded.\n",
   360                                  __func__);
   361  
   362                          first_timeout = SAA_DEVICE_TIMEOUT;
   363                          while (first_timeout) {
   364                                  msleep(10); /* Checkpatch throws a < 
20ms warning */
   365  
   366                                  version =
   367                                          
saa7164_getcurrentfirmwareversion(dev);
   368                                  if (version) {
   369                                          dprintk(DBGLVL_FW,
   370                                          "%s() All f/w loaded 
successfully\n",
   371                                                  __func__);
   372                                          break;
   373                                  } else {
   374                                          first_timeout -= 10;
   375                                          if (first_timeout == 0) {
   376                                                  printk(KERN_ERR
   377                                                  "%s() FW did not 
boot\n",
   378                                                          __func__);
   379                                                  break;
   380                                          }
   381                                  }
   382                          }
   383                  }
   384                  version = saa7164_getcurrentfirmwareversion(dev);
   385          } /* version == 0 */
   386  
   387          /* Has the firmware really booted? */
   388          if ((saa7164_readl(SAA_BOOTLOADERERROR_FLAGS) ==
   389                  SAA_DEVICE_IMAGE_BOOTING) &&
   390                  (saa7164_readl(SAA_SECONDSTAGEERROR_FLAGS) ==
   391                  SAA_DEVICE_IMAGE_BOOTING) && (version == 0)) {
   392  
   393                  printk(KERN_ERR
   394                          "%s() The firmware hung, probably bad 
firmware\n",
   395                          __func__);
   396  
   397                  /* Tell the second stage loader we have a deadlock */
   398                  saa7164_writel(SAA_DEVICE_DEADLOCK_DETECTED_OFFSET,
   399                          SAA_DEVICE_DEADLOCK_DETECTED);
   400  
   401                  saa7164_getfirmwarestatus(dev);
   402  
   403                  return -ENOMEM;
   404          }
   405  
   406          dprintk(DBGLVL_FW, "Device has Firmware Version %d.%d.%d.%d\n",
   407                  (version & 0x0000fc00) >> 10,
   408                  (version & 0x000003e0) >> 5,
   409                  (version & 0x0000001f),
   410                  (version & 0xffff0000) >> 16);
   411  
   412          /* Load the firmwware from the disk if required */
   413          if (version == 0) {
   414  
   415                  printk(KERN_INFO "%s() Waiting for firmware upload 
(%s)\n",
   416                          __func__, fwname);
   417  
   418                  ret = request_firmware(&fw, fwname, &dev->pci->dev);
   419                  if (ret) {
   420                          printk(KERN_ERR "%s() Upload failed. (file not 
found?)\n",
   421                                 __func__);
   422                          return -ENOMEM;
   423                  }
   424  
   425                  printk(KERN_INFO "%s() firmware read %zu bytes.\n",
   426                          __func__, fw->size);
   427  
   428                  if (fw->size != fwlength) {
 > 429                          printk(KERN_ERR "saa7164: firmware incorrect 
 > size %ld != %u\n",

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

Attachment: .config.gz
Description: application/gzip

Reply via email to