Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] drm/msm/dp: uninitialized hw_revision in msm_dp_display_get_panel() - [Medium] drm/msm/dp: devm_kzalloc leak and panel desync in msm_dp_display_get_panel() --
commit 81d0774848cd7711009ffa760c18571f4cc9c705 Author: Abhinav Kumar <[email protected]> drm/msm/dp: add msm_dp_display_get_panel() to initialize DP panel This commit adds msm_dp_ctrl_get_stream_cnt() and msm_dp_display_get_panel() to allocate and initialize per-stream struct msm_dp_panel instances for DP MST. > diff --git a/drivers/gpu/drm/msm/dp/dp_display.c > b/drivers/gpu/drm/msm/dp/dp_display.c > index 544b76e2c6f6e..d3d798a1da1a9 100644 > --- a/drivers/gpu/drm/msm/dp/dp_display.c > +++ b/drivers/gpu/drm/msm/dp/dp_display.c > @@ -536,6 +536,33 @@ static int msm_dp_irq_hpd_handle(struct > msm_dp_display_private *dp) > return rc; > } > > +struct msm_dp_panel *msm_dp_display_get_panel(struct msm_dp *msm_dp_display, > + enum msm_dp_stream_id stream_id) > +{ > + struct msm_dp_display_private *dp; > + struct msm_dp_panel *dp_panel; > + > + dp = container_of(msm_dp_display, struct msm_dp_display_private, > msm_dp_display); > + > + if (stream_id >= msm_dp_ctrl_get_stream_cnt(dp->ctrl)) { > + DRM_ERROR("invalid stream_id %d\n", stream_id); > + return NULL; > + } > + > + dp_panel = msm_dp_panel_get(&dp->msm_dp_display.pdev->dev, dp->aux, > dp->link, > + dp->link_base, dp->mst2link_base, > dp->mst3link_base, > + dp->pixel_base[stream_id]); [Severity: Medium] Does calling msm_dp_panel_get() here leak the devm_kzalloc() allocation on &dp->msm_dp_display.pdev->dev across KMS component unbind/rebind or bind failure? msm_dp_panel_get() ties the allocation lifetime to the DP platform device, whereas msm_dp_display_get_panel() is called during KMS component bind (_dpu_kms_initialize_displayport() -> msm_dp_mst_attach_encoder()) with no matching release when KMS unbinds. Allocating separate panel instances (including a second DP_STREAM_0 panel alongside dp->panel) also leaves dp->panel->msm_dp_mode.out_fmt_is_yuv_420 out of sync with active MST stream panels when checked by msm_dp_wide_bus_available(). > + > + if (IS_ERR(dp_panel)) { > + DRM_ERROR("failed to initialize panel\n"); > + return NULL; > + } > + > + dp_panel->stream_id = stream_id; > + > + return dp_panel; > +} [Severity: Medium] Does this leave dp_panel->hw_revision set to 0 on panels returned for MST streams? msm_dp_ctrl_reset() only populates panel->hw_revision on the SST dp->panel instance, and msm_dp_display_get_panel() runs during KMS bind before msm_dp_display_host_init() reads REG_DP_HW_VERSION. When VSC SDP is enabled or disabled on an MST stream (for example, YUV420 modes via msm_dp_panel_timing_cfg() -> msm_dp_panel_setup_vsc_sdp_yuv_420()), msm_dp_panel_update_sdp() checks: drivers/gpu/drm/msm/dp/dp_panel.c:msm_dp_panel_update_sdp() { u32 hw_revision = panel->msm_dp_panel.hw_revision; if (hw_revision >= DP_HW_VERSION_1_0 && hw_revision < DP_HW_VERSION_1_2) { msm_dp_write_link(panel, MMSS_DP_SDP_CFG3, UPDATE_SDP); msm_dp_write_link(panel, MMSS_DP_SDP_CFG3, 0x0); } } With hw_revision left at 0, the MMSS_DP_SDP_CFG3 update pulse is skipped on DP 1.0 and 1.1 controllers. -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=11
