public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm: fix dead default for DRM_TTM_KUNIT_TEST
@ 2026-03-22 22:01 Julian Braha
  2026-03-23  9:43 ` Christian König
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Julian Braha @ 2026-03-22 22:01 UTC (permalink / raw)
  To: mripard, maarten.lankhorst, tzimmermann, christian.koenig,
	karolina.stolarek
  Cc: airlied, simona, dri-devel, linux-kernel, Julian Braha

The DRM_TTM_KUNIT_TEST config option should default
to KUNIT_ALL_TESTS so that if all tests are enabled then
it is included, but currently the 'default KUNIT_ALL_TESTS'
statement is shadowed by an unconditional 'default n',
meaning that this second default statement is currently dead code.

This dead code was found by kconfirm, a static analysis
tool for Kconfig.

Fixes: e3912d09bf8d ("drm/ttm: Introduce KUnit test")
Signed-off-by: Julian Braha <julianbraha@gmail.com>
---
 drivers/gpu/drm/Kconfig.debug | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/Kconfig.debug b/drivers/gpu/drm/Kconfig.debug
index 05dc43c0b8c5..75c186f938b0 100644
--- a/drivers/gpu/drm/Kconfig.debug
+++ b/drivers/gpu/drm/Kconfig.debug
@@ -86,7 +86,6 @@ config DRM_KUNIT_TEST
 
 config DRM_TTM_KUNIT_TEST
 	tristate "KUnit tests for TTM" if !KUNIT_ALL_TESTS
-	default n
 	depends on DRM && KUNIT && MMU && (UML || COMPILE_TEST)
 	select DRM_TTM
 	select DRM_BUDDY
-- 
2.51.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm: fix dead default for DRM_TTM_KUNIT_TEST
  2026-03-22 22:01 [PATCH] drm: fix dead default for DRM_TTM_KUNIT_TEST Julian Braha
@ 2026-03-23  9:43 ` Christian König
  2026-03-24 22:10 ` Claude review: " Claude Code Review Bot
  2026-03-24 22:10 ` Claude Code Review Bot
  2 siblings, 0 replies; 6+ messages in thread
From: Christian König @ 2026-03-23  9:43 UTC (permalink / raw)
  To: Julian Braha, mripard, maarten.lankhorst, tzimmermann,
	karolina.stolarek
  Cc: airlied, simona, dri-devel, linux-kernel

Hi Julian,

On 3/22/26 23:01, Julian Braha wrote:
> The DRM_TTM_KUNIT_TEST config option should default
> to KUNIT_ALL_TESTS so that if all tests are enabled then
> it is included, but currently the 'default KUNIT_ALL_TESTS'
> statement is shadowed by an unconditional 'default n',
> meaning that this second default statement is currently dead code.

I need to double check the discussion back then, but I think the tests were pretty beta when initially merged.

So it was intentionally to not include them automatically when KUNIT_ALL_TESTS is enabled.

We can probably do that since the tests are stable now, but I think we should definitely drop the Fixes tag.

Regards,
Christian.

> 
> This dead code was found by kconfirm, a static analysis
> tool for Kconfig.
> 
> Fixes: e3912d09bf8d ("drm/ttm: Introduce KUnit test")
> Signed-off-by: Julian Braha <julianbraha@gmail.com>
> ---
>  drivers/gpu/drm/Kconfig.debug | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/Kconfig.debug b/drivers/gpu/drm/Kconfig.debug
> index 05dc43c0b8c5..75c186f938b0 100644
> --- a/drivers/gpu/drm/Kconfig.debug
> +++ b/drivers/gpu/drm/Kconfig.debug
> @@ -86,7 +86,6 @@ config DRM_KUNIT_TEST
> 
>  config DRM_TTM_KUNIT_TEST
>         tristate "KUnit tests for TTM" if !KUNIT_ALL_TESTS
> -       default n
>         depends on DRM && KUNIT && MMU && (UML || COMPILE_TEST)
>         select DRM_TTM
>         select DRM_BUDDY
> --
> 2.51.2
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Claude review: drm: fix dead default for DRM_TTM_KUNIT_TEST
  2026-03-23 12:41 [PATCH v2] " Julian Braha
@ 2026-03-24 21:52 ` Claude Code Review Bot
  2026-03-24 21:52 ` Claude Code Review Bot
  1 sibling, 0 replies; 6+ messages in thread
From: Claude Code Review Bot @ 2026-03-24 21:52 UTC (permalink / raw)
  To: dri-devel-reviews

Overall Series Review

Subject: drm: fix dead default for DRM_TTM_KUNIT_TEST
Author: Julian Braha <julianbraha@gmail.com>
Patches: 2
Reviewed: 2026-03-25T07:52:18.917094

---

This is a single, straightforward Kconfig fix. The analysis is correct: in Kconfig, when multiple `default` statements exist, the **first** one encountered takes precedence. Here, `default n` on line 88 comes before `default KUNIT_ALL_TESTS` on line 94, so the latter is dead code — `KUNIT_ALL_TESTS` can never actually influence the default value of `DRM_TTM_KUNIT_TEST`.

The fix (removing `default n`) is the right approach. Once removed, `default KUNIT_ALL_TESTS` becomes effective, and when `KUNIT_ALL_TESTS` is not set, Kconfig's implicit default for tristate is `n` anyway, so behavior is preserved for users who don't set `KUNIT_ALL_TESTS`.

**Verdict: Patch looks good.**

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Claude review: drm: fix dead default for DRM_TTM_KUNIT_TEST
  2026-03-23 12:41 [PATCH v2] " Julian Braha
  2026-03-24 21:52 ` Claude review: " Claude Code Review Bot
@ 2026-03-24 21:52 ` Claude Code Review Bot
  1 sibling, 0 replies; 6+ messages in thread
From: Claude Code Review Bot @ 2026-03-24 21:52 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

**Commit message:** Clear and well-written. Explains the problem (shadowed default), the tool that found it (kconfirm), and what the fix does.

**Code change:** Correct. Looking at the existing file (`Kconfig.debug:86-94`), we can see:

```
config DRM_TTM_KUNIT_TEST
	tristate "KUnit tests for TTM" if !KUNIT_ALL_TESTS
	default n                      <-- first default, always wins
	depends on DRM && KUNIT && MMU && (UML || COMPILE_TEST)
	select DRM_TTM
	select DRM_BUDDY
	select DRM_EXPORT_FOR_TESTS if m
	select DRM_KUNIT_TEST_HELPERS
	default KUNIT_ALL_TESTS        <-- dead code, never reached
```

Removing `default n` makes `default KUNIT_ALL_TESTS` the sole default, which is the intended behavior. This is consistent with the pattern used by `DRM_SCHED_KUNIT_TEST` (line 103-107) and `DRM_KUNIT_TEST` earlier in the same file, which don't have a `default n` overriding their `default KUNIT_ALL_TESTS`.

**Minor style note:** After removal, the `default KUNIT_ALL_TESTS` on line 94 sits after several `select` statements. It would be slightly more conventional to place `default` right after `depends on` (matching `DRM_SCHED_KUNIT_TEST`'s ordering), but that's a purely cosmetic nit and not worth blocking the patch.

**Reviewed-by worthy:** Yes, this is a clean, correct fix.

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Claude review: drm: fix dead default for DRM_TTM_KUNIT_TEST
  2026-03-22 22:01 [PATCH] drm: fix dead default for DRM_TTM_KUNIT_TEST Julian Braha
  2026-03-23  9:43 ` Christian König
  2026-03-24 22:10 ` Claude review: " Claude Code Review Bot
@ 2026-03-24 22:10 ` Claude Code Review Bot
  2 siblings, 0 replies; 6+ messages in thread
From: Claude Code Review Bot @ 2026-03-24 22:10 UTC (permalink / raw)
  To: dri-devel-reviews

Overall Series Review

Subject: drm: fix dead default for DRM_TTM_KUNIT_TEST
Author: Julian Braha <julianbraha@gmail.com>
Patches: 2
Reviewed: 2026-03-25T08:10:58.665235

---

This is a single-patch fix for a Kconfig ordering issue in `DRM_TTM_KUNIT_TEST`. The analysis is correct: the `default n` on line 88 shadows the `default KUNIT_ALL_TESTS` on line 94, making the latter dead code. In Kconfig, when multiple `default` statements exist, the **first** one that is visible (no unsatisfied `if` condition) wins. Since `default n` is unconditional, it always takes precedence and the `KUNIT_ALL_TESTS` default never applies.

The fix is straightforward, correct, and consistent with how other similar Kconfig entries in the same file are structured (e.g., `DRM_KUNIT_TEST` at line 60 and `DRM_SCHED_KUNIT_TEST` at line 103 both use only `default KUNIT_ALL_TESTS` without a preceding `default n`).

**Verdict: Patch looks good.**

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Claude review: drm: fix dead default for DRM_TTM_KUNIT_TEST
  2026-03-22 22:01 [PATCH] drm: fix dead default for DRM_TTM_KUNIT_TEST Julian Braha
  2026-03-23  9:43 ` Christian König
@ 2026-03-24 22:10 ` Claude Code Review Bot
  2026-03-24 22:10 ` Claude Code Review Bot
  2 siblings, 0 replies; 6+ messages in thread
From: Claude Code Review Bot @ 2026-03-24 22:10 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

**Correctness:** The patch correctly removes the `default n` line. After removal, the remaining `default KUNIT_ALL_TESTS` will properly take effect — defaulting to `y` when `KUNIT_ALL_TESTS=y`, and to `n` otherwise (since Kconfig tristates default to `n` when no default matches).

**Commit message:** Clear and well-written. Correctly identifies the problem (shadowed default), references the tool that found it, and includes a proper `Fixes:` tag pointing to commit `e3912d09bf8d ("drm/ttm: Introduce KUnit test")`.

**Style note:** After this patch, the `default KUNIT_ALL_TESTS` line (currently line 94 in the tree) sits after the `select` statements, which matches the ordering used by `DRM_KUNIT_TEST` and `DRM_SCHED_KUNIT_TEST` in the same file. No issues there.

**One minor observation:** The ordering convention in this file for the other entries places `default KUNIT_ALL_TESTS` *after* the `select` blocks. The patched result preserves that convention, which is good.

Reviewed-by assessment: This patch is correct and ready to apply.

---
Generated by Claude Code Patch Reviewer

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-03-24 22:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-22 22:01 [PATCH] drm: fix dead default for DRM_TTM_KUNIT_TEST Julian Braha
2026-03-23  9:43 ` Christian König
2026-03-24 22:10 ` Claude review: " Claude Code Review Bot
2026-03-24 22:10 ` Claude Code Review Bot
  -- strict thread matches above, loose matches on Subject: below --
2026-03-23 12:41 [PATCH v2] " Julian Braha
2026-03-24 21:52 ` Claude review: " Claude Code Review Bot
2026-03-24 21:52 ` Claude Code Review Bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox