[bug report] staging: wfx: load the firmware faster

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

 



Hello Jérôme Pouiller,

The patch a9408ad79ff3: "staging: wfx: load the firmware faster" from
Jul 1, 2020, leads to the following static checker warning:

	drivers/staging/wfx/fwio.c:192 upload_firmware()
	error: uninitialized symbol 'bytes_done'.

drivers/staging/wfx/fwio.c
   177  static int upload_firmware(struct wfx_dev *wdev, const u8 *data, size_t len)
   178  {
   179          int ret;
   180          u32 offs, bytes_done;
                          ^^^^^^^^^^

   181          ktime_t now, start;
   182  
   183          if (len % DNLD_BLOCK_SIZE) {
   184                  dev_err(wdev->dev, "firmware size is not aligned. Buffer overrun will occur\n");
   185                  return -EIO;
   186          }
   187          offs = 0;
   188          while (offs < len) {
   189                  start = ktime_get();
   190                  for (;;) {
   191                          now = ktime_get();
   192                          if (offs + DNLD_BLOCK_SIZE - bytes_done < DNLD_FIFO_SIZE)
                                                             ^^^^^^^^^^
Uninitialized.

   193                                  break;
   194                          if (ktime_after(now, ktime_add_ms(start, DCA_TIMEOUT)))
   195                                  return -ETIMEDOUT;
   196                          ret = sram_reg_read(wdev, WFX_DCA_GET, &bytes_done);
                                                                        ^^^^^^^^^^
too late.  Hashtag Sad Face.

   197                          if (ret < 0)
   198                                  return ret;
   199                  }
   200                  if (ktime_compare(now, start))
   201                          dev_dbg(wdev->dev, "answer after %lldus\n",
   202                                  ktime_us_delta(now, start));
   203  
   204                  ret = sram_write_dma_safe(wdev, WFX_DNLD_FIFO +
   205                                            (offs % DNLD_FIFO_SIZE),
   206                                            data + offs, DNLD_BLOCK_SIZE);
   207                  if (ret < 0)
   208                          return ret;
   209  
   210                  // WFx seems to not support writing 0 in this register during
   211                  // first loop
   212                  offs += DNLD_BLOCK_SIZE;
   213                  ret = sram_reg_write(wdev, WFX_DCA_PUT, offs);
   214                  if (ret < 0)
   215                          return ret;
   216          }
   217          return 0;
   218  }

regards,
dan carpenter
_______________________________________________
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