hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/watchdog/dw_wdt.c
....@@ -156,6 +156,10 @@
156156 break;
157157 }
158158
159
+ /* For Coverity check */
160
+ if (idx == DW_WDT_NUM_TOPS)
161
+ idx = 0;
162
+
159163 return dw_wdt->timeouts[idx].sec;
160164 }
161165
....@@ -178,6 +182,9 @@
178182 if (dw_wdt->timeouts[idx].top_val == top_val)
179183 break;
180184 }
185
+
186
+ if (idx == DW_WDT_NUM_TOPS)
187
+ idx = 0;
181188
182189 /*
183190 * In IRQ mode due to the two stages counter, the actual timeout is
....@@ -638,7 +645,7 @@
638645
639646 ret = dw_wdt_init_timeouts(dw_wdt, dev);
640647 if (ret)
641
- goto out_disable_clk;
648
+ goto out_assert_rst;
642649
643650 wdd = &dw_wdt->wdd;
644651 wdd->ops = &dw_wdt_ops;
....@@ -669,12 +676,15 @@
669676
670677 ret = watchdog_register_device(wdd);
671678 if (ret)
672
- goto out_disable_pclk;
679
+ goto out_assert_rst;
673680
674681 dw_wdt_dbgfs_init(dw_wdt);
675682
676683 return 0;
677684
685
+out_assert_rst:
686
+ reset_control_assert(dw_wdt->rst);
687
+
678688 out_disable_pclk:
679689 clk_disable_unprepare(dw_wdt->pclk);
680690