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/mediatek: Use dp_connector helpers to report link training state Date: Sun, 12 Apr 2026 10:51:26 +1000 Message-ID: In-Reply-To: <20260409-feat_link_cap-v1-12-7069e8199ce2@bootlin.com> References: <20260409-feat_link_cap-v1-0-7069e8199ce2@bootlin.com> <20260409-feat_link_cap-v1-12-7069e8199ce2@bootlin.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review **Bug -- `bridge.ops` overwrite:** ```c mtk_dp->bridge.dp_link_train_caps = &dp_link_train_caps; mtk_dp->bridge.ops = DRM_BRIDGE_OP_DP; if (mtk_dp->bridge.type == DRM_MODE_CONNECTOR_eDP) { ... } else { mtk_dp->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID | DRM_BRIDGE_OP_HPD; ``` For the non-eDP (regular DP) case, the `else` branch overwrites `bridge.ops` to `DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID | DRM_BRIDGE_OP_HPD`, losing `DRM_BRIDGE_OP_DP`. The fix is to change the else branch to use `|=` or move the `DRM_BRIDGE_OP_DP` assignment after the conditional and use `|=`. For the eDP case, `DRM_BRIDGE_OP_DP` would stick, but the eDP branch never calls `devm_drm_bridge_add()` directly (it's called from `mtk_dp_edp_link_panel`), and it lacks DETECT/EDID/HPD ops which may cause issues. **Bug -- uninitialized `dp_link_train` in `mtk_dp_report_link_train()`:** ```c struct drm_connector_dp_link_train dp_link_train; dp_link_train.rate = drm_dp_bw_code_to_link_rate(mtk_dp->train_info.link_rate); dp_link_train.nlanes = mtk_dp->train_info.lane_count; ``` `dsc_en` is never set, and remaining `v_swing[]`/`pre_emph[]` entries (for lanes beyond `lane_count`) are uninitialized. Should be `= {};`. Note: the `dp_link_train_caps` struct doesn't set `.dsc = true`, so the `dsc_en` property won't be created, and the uninitialized `dsc_en` field in the report won't cause a NULL deref. But the struct should still be zero-initialized for correctness. **Minor -- untested.** The author explicitly notes this patch is untested. Given the bugs above, it clearly needs testing before non-RFC submission. --- Generated by Claude Code Patch Reviewer