Linux Watchdog driver development
 help / color / mirror / Atom feed
* re: watchdog: Convert wm831x driver to watchdog core
@ 2011-11-04 18:44 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2011-11-04 18:44 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-watchdog

Hi Mark,

Smatch complains about 21cef54c0b1 "watchdog: Convert wm831x driver
to watchdog core"

drivers/watchdog/wm831x_wdt.c +159 wm831x_wdt_set_timeout(17)
	error: buffer overflow 'wm831x_wdt_cfgs' 7 <= 7

   142  static int wm831x_wdt_set_timeout(struct watchdog_device *wdt_dev,
   143                                    unsigned int timeout)
   144  {
   145          struct wm831x_wdt_drvdata *driver_data = watchdog_get_drvdata(wdt_dev);
   146          struct wm831x *wm831x = driver_data->wm831x;
   147          int ret, i;
   148  
   149          for (i = 0; i < ARRAY_SIZE(wm831x_wdt_cfgs); i++)
   150                  if (wm831x_wdt_cfgs[i].time == timeout)
   151                          break;
   152          if (i == ARRAY_SIZE(wm831x_wdt_cfgs))
   153                  ret = -EINVAL;
                        ^^^^^^^^^^^^^^

We overwrite this return value on the next line.  I don't know the
code well enough to say if the intent was to return directly or to
unlock first and then return.

   154  
   155          ret = wm831x_reg_unlock(wm831x);

regards,
dan carpenter

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-11-04 18:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-04 18:44 watchdog: Convert wm831x driver to watchdog core Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox