From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: drm: Suppress intentional warning backtraces in scaling unit tests Date: Sat, 16 May 2026 09:18:01 +1000 Message-ID: In-Reply-To: <20260515-kunit_add_support-v13-3-18ee42f96e7b@redhat.com> References: <20260515-kunit_add_support-v13-0-18ee42f96e7b@redhat.com> <20260515-kunit_add_support-v13-3-18ee42f96e7b@redhat.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Patch Review **Good real-world demonstration of the API.** ```c + int expected_warnings =3D IS_ENABLED(CONFIG_BUG) ? + (params->expected_scaling_factor =3D=3D -EINVAL) : 0; + int scaling_factor =3D INT_MIN; ``` The `INT_MIN` initialization is defensive =E2=80=94 if the `kunit_warning_s= uppress` block fails to set up (returns NULL due to allocation failure), `s= caling_factor` retains a sentinel value that won't accidentally match the e= xpected value. The `#include ` is added for `INT_MIN`. The `expected_warnings` computation is clever: on `CONFIG_BUG=3Dn`, WARN_ON= is a no-op, so the counter stays zero. On `CONFIG_BUG=3Dy`, warnings fire = only for the `-EINVAL` test cases (bad parameters). The boolean-to-int conv= ersion `(params->expected_scaling_factor =3D=3D -EINVAL)` yields 0 or 1, wh= ich is correct. ```c + kunit_warning_suppress(test) { + scaling_factor =3D drm_rect_calc_hscale(¶ms->src, ¶ms->dst, + params->min_range, + params->max_range); + KUNIT_EXPECT_SUPPRESSED_WARNING_COUNT(test, expected_warnings); + } =20 KUNIT_EXPECT_EQ(test, scaling_factor, params->expected_scaling_factor); ``` The `KUNIT_EXPECT_EQ` check on `scaling_factor` is correctly placed *outsid= e* the suppress block =E2=80=94 it doesn't need suppression and this keeps = the suppress scope as narrow as possible. The warning count check is inside= the block as required by the API. **No issues found.** --- --- Generated by Claude Code Patch Reviewer