Re: [PATCH v2 09/10] drm/bridge: analogix_dp: Restrict forced connected status only for panel endpoint
[email protected] Tue, 04 Aug 2026 08:30:52 +0000
| Newsgroups | org.freedesktop.lists.dri-devel,org.kernel.vger.linux-devicetree |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] Missing early return in analogix_dp_bridge_detect() causes unintended hardware accesses and significant delays for panel bridges. - [Medium] Missing drm_bridge_put() causes a reference count leak for the bridge returned by drm_bridge_chain_get_last_bridge(). -- --- Patch [9]: [PATCH v2 09/10] drm/bridge: analogix_dp: Restrict forced connected status only for panel endpoint --- commit 7e658941bfdab69a58f5d04d4acd4ae671e37ea8 Author: Damon Ding <[email protected]> drm/bridge: analogix_dp: Restrict forced connected status only for panel endpoint This commit limits the unconditional connected status shortcut to cases where the last bridge in the chain is a panel. For other cases, it relies on analogix_dp_detect_hpd() to report accurate hotplug state. Link: https://lore.kernel.org/all/5209243.oAaWjsssbx@diego/ > diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c > index 1c85ca93ee7b1..f7db5b5a3f917 100644 > --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c > +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c > @@ -910,8 +910,15 @@ analogix_dp_bridge_detect(struct drm_bridge *bridge, struct drm_connector *conne > struct analogix_dp_device *dp = to_dp(bridge); > enum drm_connector_status status = connector_status_disconnected; > > - if (dp->plat_data->next_bridge) > - return connector_status_connected; > + /* > + * Only assume connected when the bridge chain ends with a panel. > + * Panel bridges lack a detect callback and historically rely on > + * this shortcut. For other next bridge types (e.g., DP connector > + * bridges), fall through to analogix_dp_detect_hpd() to report > + * accurate hotplug state. > + */ > + if (dp->plat_data->next_bridge && dp->last_bridge_is_panel) > + status = connector_status_connected; > > if (!analogix_dp_detect_hpd(dp)) > status = connector_status_connected; [Severity: High] Does this unintentionally fall through and execute analogix_dp_detect_hpd() even when the bridge chain ends with a panel? Previously, analogix_dp_bridge_detect() returned early here. By just assigning the status without returning, it looks like panel bridges will now unconditionally execute analogix_dp_detect_hpd(). This can introduce an unnecessary 100ms delay and unintended register/AUX writes to manually force HPD on hardware that lacks an HPD signal. Should there be an early return here instead of continuing execution? [ ... ] > @@ -938,6 +946,10 @@ static int analogix_dp_bridge_attach(struct drm_bridge *bridge, > dev_err(dp->dev, "failed to attach following panel or bridge (%d)\n", ret); > return ret; > } > + > + last_bridge = drm_bridge_chain_get_last_bridge(dp->encoder); > + if (drm_bridge_is_panel(last_bridge)) > + dp->last_bridge_is_panel = true; > } > > return 0; [Severity: Medium] Does this leak the reference to the last bridge in analogix_dp_bridge_attach()? drm_bridge_chain_get_last_bridge() increments the reference count of the returned bridge, but it doesn't appear that drm_bridge_put() is called before the function returns. Will this prevent proper cleanup when the device is unbound or the module is unloaded? -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=9