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:36:17 +1000 Message-ID: In-Reply-To: <20260515-kunit_add_support-v12-3-a216dc228be8@redhat.com> References: <20260515-kunit_add_support-v12-0-a216dc228be8@redhat.com> <20260515-kunit_add_support-v12-3-a216dc228be8@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 Clean application of the scoped API. **1. The `expected_warnings` calculation is clever:** ```c + int expected_warnings =3D IS_ENABLED(CONFIG_BUG) ? + (params->expected_scaling_factor =3D=3D -EINVAL) : 0; ``` When `CONFIG_BUG=3Dn`, `WARN_ON()` is a no-op, so no warnings fire and the = count stays at 0. This handles the conditional cleanly without `#ifdef`. Th= e expression `(params->expected_scaling_factor =3D=3D -EINVAL)` evaluates t= o 0 or 1, matching whether the specific test case triggers a warning or not. **2. `scaling_factor =3D INT_MIN` initialization:** ```c + int scaling_factor =3D INT_MIN; ``` Necessary because if `kunit_start_suppress_warning()` fails (returns NULL),= the for-loop body doesn't execute, and `scaling_factor` would be uninitial= ized at the `KUNIT_EXPECT_EQ` check below. `INT_MIN` is a safe sentinel (no= test case expects it). Good fix from v10. **3. The `KUNIT_EXPECT_EQ` for `scaling_factor` is outside the suppression = block:** ```c + kunit_warning_suppress(test) { + scaling_factor =3D drm_rect_calc_hscale(...); + KUNIT_EXPECT_SUPPRESSED_WARNING_COUNT(test, expected_warnings); + } KUNIT_EXPECT_EQ(test, scaling_factor, params->expected_scaling_factor); ``` This is the right structure =E2=80=94 the warning count must be inside the = block, but the functional assertion can (and should) be outside it. Clean. **4. Nit: the `#include ` addition for `INT_MIN`:** ```c +#include ``` Correct include for `INT_MIN`. --- Generated by Claude Code Patch Reviewer