Guard clkcnt division against a zero line count

get_status() divides before check_linecnt() validates totlines; with no
lines measured the divisor is zero (RISC-V returns all ones silently).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WiXHy7Jhh5yTdsBaenucgw
This commit is contained in:
Peter YooandClaude Fable 5.1 committed 2026-09-18 22:10:53 +09:00
1 parent 5fd71e8312
commit 5ff096e9d4
1 file changed
+1 -1
+1 -1
View File
@@ -369,7 +369,7 @@ status_t get_status(tvp_sync_input_t syncinput)
pcnt_field = (unsigned long)sc->fe_status2.pcnt_field;
hsync_width = (unsigned long)sc->fe_status2.hsync_width;
clkcnt = pcnt_field/(totlines>>!progressive);
clkcnt = (totlines>>!progressive) ? pcnt_field/(totlines>>!progressive) : 0;
valid_mode = (pcnt_field > 0) && check_linecnt(progressive, totlines);
// Check sync activity