watchdog: Convert wm831x driver to watchdog core
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