All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] staging: wfx: load the firmware faster
@ 2020-07-09  9:26 dan.carpenter
  2020-07-09 10:09 ` Jérôme Pouiller
  0 siblings, 1 reply; 3+ messages in thread
From: dan.carpenter @ 2020-07-09  9:26 UTC (permalink / raw)
  To: jerome.pouiller; +Cc: devel

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@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [bug report] staging: wfx: load the firmware faster
  2020-07-09  9:26 [bug report] staging: wfx: load the firmware faster dan.carpenter
@ 2020-07-09 10:09 ` Jérôme Pouiller
  2020-07-09 10:55   ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Jérôme Pouiller @ 2020-07-09 10:09 UTC (permalink / raw)
  To: dan.carpenter; +Cc: devel

On Thursday 9 July 2020 11:26:29 CEST dan.carpenter@oracle.com wrote:
> 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'.

Hello Dan,

Colin has reacted faster:
   https://lkml.org/lkml/2020/7/6/387

BTW, I though gcc was able to detect that, but I didn't get any warning 
on my side.


-- 
Jérôme Pouiller


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [bug report] staging: wfx: load the firmware faster
  2020-07-09 10:09 ` Jérôme Pouiller
@ 2020-07-09 10:55   ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2020-07-09 10:55 UTC (permalink / raw)
  To: Jérôme Pouiller; +Cc: devel

On Thu, Jul 09, 2020 at 12:09:12PM +0200, Jérôme Pouiller wrote:
> On Thursday 9 July 2020 11:26:29 CEST dan.carpenter@oracle.com wrote:
> > 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'.
> 
> Hello Dan,
> 
> Colin has reacted faster:
>    https://lkml.org/lkml/2020/7/6/387
> 
> BTW, I though gcc was able to detect that, but I didn't get any warning 
> on my side.

GCC stopped working.  I don't know if it's because of the new pluggin
which initializes stack variables or what the heck is going on.  There
has been a bug with this for years, but it's suddenly got a lot worse...

regards,
dan carpenter

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-09 10:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-09  9:26 [bug report] staging: wfx: load the firmware faster dan.carpenter
2020-07-09 10:09 ` Jérôme Pouiller
2020-07-09 10:55   ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.