public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/bridge: synopsys: dw-dp: fix bool function returning negative error code
@ 2026-05-11  6:39 Bob ynn
  2026-05-16  2:19 ` Claude review: " Claude Code Review Bot
  2026-05-16  2:19 ` Claude Code Review Bot
  0 siblings, 2 replies; 4+ messages in thread
From: Bob ynn @ 2026-05-11  6:39 UTC (permalink / raw)
  To: dri-devel; +Cc: andy.yan, dmitry.baryshkov, yanlonglong

From: yanlonglong <yanlonglong@kylinos.cn>

The function dw_dp_video_need_vsc_sdp() is declared to return bool, but
it returns -EINVAL when dw_dp_get_bridge_state() fails. Since -EINVAL is
a non-zero value (-22), it is implicitly converted to true, which is the
opposite of the intended behavior

Fixes: 86eecc3a9c2e("drm/bridge: synopsys: Add DW DPTX Controller support library")
Signed-off-by: yanlonglong <yanlonglong@kylinos.cn>
---
 drivers/gpu/drm/bridge/synopsys/dw-dp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-dp.c b/drivers/gpu/drm/bridge/synopsys/dw-dp.c
index 21541be094c4..7b99d91b3456 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-dp.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-dp.c
@@ -1143,7 +1143,7 @@ static bool dw_dp_video_need_vsc_sdp(struct dw_dp *dp)
 
 	state = dw_dp_get_bridge_state(dp);
 	if (!state)
-		return -EINVAL;
+		return false;
 
 	if (!link->vsc_sdp_supported)
 		return false;
-- 
2.43.0


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

* [PATCH] drm/bridge: synopsys: dw-dp: fix bool function returning negative error code
@ 2026-05-15  2:01 Bob ynn
  0 siblings, 0 replies; 4+ messages in thread
From: Bob ynn @ 2026-05-15  2:01 UTC (permalink / raw)
  To: dri-devel
  Cc: linux-kernel, Andy Yan, Andrzej Hajda, Neil Armstrong,
	Robert Foss, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Luca Ceresoli, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, yanlonglong

From: yanlonglong <yanlonglong@kylinos.cn>

The function dw_dp_video_need_vsc_sdp() is declared to return bool, but
it returns -EINVAL when dw_dp_get_bridge_state() fails. Since -EINVAL is
a non-zero value (-22), it is implicitly converted to true, which is the
opposite of the intended behavior

Fixes: 86eecc3a9c2e("drm/bridge: synopsys: Add DW DPTX Controller support library")
Signed-off-by: yanlonglong <yanlonglong@kylinos.cn>
---
 drivers/gpu/drm/bridge/synopsys/dw-dp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-dp.c b/drivers/gpu/drm/bridge/synopsys/dw-dp.c
index 21541be094c4..7b99d91b3456 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-dp.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-dp.c
@@ -1143,7 +1143,7 @@ static bool dw_dp_video_need_vsc_sdp(struct dw_dp *dp)
 
 	state = dw_dp_get_bridge_state(dp);
 	if (!state)
-		return -EINVAL;
+		return false;
 
 	if (!link->vsc_sdp_supported)
 		return false;
-- 
2.43.0


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

* Claude review: drm/bridge: synopsys: dw-dp: fix bool function returning negative error code
  2026-05-11  6:39 [PATCH] drm/bridge: synopsys: dw-dp: fix bool function returning negative error code Bob ynn
@ 2026-05-16  2:19 ` Claude Code Review Bot
  2026-05-16  2:19 ` Claude Code Review Bot
  1 sibling, 0 replies; 4+ messages in thread
From: Claude Code Review Bot @ 2026-05-16  2:19 UTC (permalink / raw)
  To: dri-devel-reviews

Overall Series Review

Subject: drm/bridge: synopsys: dw-dp: fix bool function returning negative error code
Author: Bob ynn <yanlonglong@kylinos.cn>
Patches: 1
Reviewed: 2026-05-16T12:19:33.015984

---

This is a single-patch series fixing a clear bug: a `bool`-returning function (`dw_dp_video_need_vsc_sdp`) was returning `-EINVAL` on an error path. Since `-EINVAL` is `-22` (non-zero), it gets implicitly converted to `true`, which is the opposite of the safe/intended behavior — it would incorrectly signal that a VSC SDP is needed when the bridge state can't be retrieved.

The fix is minimal, correct, and appropriate. Returning `false` on failure is the conservative and safe choice here: if the bridge state can't be obtained, the function should not claim a VSC SDP is needed.

**Verdict: The patch looks good and should be accepted.**

---
Generated by Claude Code Patch Reviewer

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

* Claude review: drm/bridge: synopsys: dw-dp: fix bool function returning negative error code
  2026-05-11  6:39 [PATCH] drm/bridge: synopsys: dw-dp: fix bool function returning negative error code Bob ynn
  2026-05-16  2:19 ` Claude review: " Claude Code Review Bot
@ 2026-05-16  2:19 ` Claude Code Review Bot
  1 sibling, 0 replies; 4+ messages in thread
From: Claude Code Review Bot @ 2026-05-16  2:19 UTC (permalink / raw)
  To: dri-devel-reviews

Patch Review

**Bug analysis:** Correct. The function signature is:
```c
static bool dw_dp_video_need_vsc_sdp(struct dw_dp *dp)
```
The old code had:
```c
state = dw_dp_get_bridge_state(dp);
if (!state)
    return -EINVAL;
```
`-EINVAL` is `-22`, which when cast to `bool` becomes `true`. This would cause callers at lines 1163 and 1388 to incorrectly set `DP_MSA_MISC_COLOR_VSC_SDP` or take the VSC SDP code path when the bridge state couldn't be retrieved — the opposite of the intended "bail out" behavior.

**Fix assessment:** The change to `return false` is correct. When `dw_dp_get_bridge_state()` fails, the safe default is to not require a VSC SDP. Both callers treat `true` as "do extra VSC SDP work", so `false` correctly skips that path on error.

**Minor nits (non-blocking):**
- The Fixes tag formatting has a minor style issue: `Fixes: 86eecc3a9c2e("drm/bridge:...` should have a space before the parenthesis per kernel convention: `Fixes: 86eecc3a9c2e ("drm/bridge:...`
- The commit message is missing a period at the end of the description paragraph ("the opposite of the intended behavior" → "the opposite of the intended behavior.").

**Reviewed-by worthy:** Yes — this is a clear, minimal, and correct bug fix.

---
Generated by Claude Code Patch Reviewer

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

end of thread, other threads:[~2026-05-16  2:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-11  6:39 [PATCH] drm/bridge: synopsys: dw-dp: fix bool function returning negative error code Bob ynn
2026-05-16  2:19 ` Claude review: " Claude Code Review Bot
2026-05-16  2:19 ` Claude Code Review Bot
  -- strict thread matches above, loose matches on Subject: below --
2026-05-15  2:01 [PATCH] " Bob ynn

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