From: Arun Iyengar <[email protected]>

If no bus format chain fits, drm_atomic_bridge_chain_check() passes
-ENOTSUPP from the negotiation to userspace. Return -EINVAL instead and
update the KUnit test that expects -ENOTSUPP.

Fixes: f32df58acc68 ("drm/bridge: Add the necessary bits to support bus format 
negotiation")
Signed-off-by: Arun Iyengar <[email protected]>
---
Tested with the drm KUnit tests (UML).
Developed with Claude (Anthropic), which wrote the code and the commit
message. I reviewed it.
---
Changes in v3:
- Shorter commit message, without the DW DP example (Nicolas Frattaroli)
- Drop the code comment
- Link to v2: 
https://patch.msgid.link/[email protected]

Changes in v2:
- Make drm_test_bridge_rgb_yuv_no_path() expect -EINVAL (Sashiko)
- Add the Fixes tag (Sashiko)
- Cc Nicolas Frattaroli and Boris Brezillon
- Link to v1: 
https://patch.msgid.link/[email protected]
---
 drivers/gpu/drm/drm_bridge.c            | 6 ++++++
 drivers/gpu/drm/tests/drm_bridge_test.c | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
index 8ae2f9b1db44..33120cc7f982 100644
--- a/drivers/gpu/drm/drm_bridge.c
+++ b/drivers/gpu/drm/drm_bridge.c
@@ -1437,6 +1437,12 @@ int drm_atomic_bridge_chain_check(struct drm_bridge 
*bridge,
 
        ret = drm_atomic_bridge_chain_select_bus_fmts(bridge, crtc_state,
                                                      conn_state);
+       if (ret == -ENOTSUPP) {
+               drm_dbg_atomic(bridge->dev,
+                              "[ENCODER:%d:%s] no bus format chain found\n",
+                              bridge->encoder->base.id, bridge->encoder->name);
+               return -EINVAL;
+       }
        if (ret)
                return ret;
 
diff --git a/drivers/gpu/drm/tests/drm_bridge_test.c 
b/drivers/gpu/drm/tests/drm_bridge_test.c
index 15583ade8494..792dbd035501 100644
--- a/drivers/gpu/drm/tests/drm_bridge_test.c
+++ b/drivers/gpu/drm/tests/drm_bridge_test.c
@@ -1351,7 +1351,7 @@ static void drm_test_bridge_rgb_yuv_no_path(struct kunit 
*test)
                drm_modeset_backoff(&ctx);
                goto retry_commit;
        }
-       KUNIT_EXPECT_EQ(test, ret, -ENOTSUPP);
+       KUNIT_EXPECT_EQ(test, ret, -EINVAL);
 
        drm_modeset_drop_locks(&ctx);
        drm_modeset_acquire_fini(&ctx);

---
base-commit: 8deaade4a5a4ff635df91e246e42139ab2b33f6d
change-id: 20261110-drm-bridge-busfmt-einval-2cc8b3d10493

Best regards,
--  
Arun Iyengar <[email protected]>


Reply via email to