Hello Luca, On 5/20/2026 8:45 AM, Luca Ceresoli wrote: > Hello Jonas, > > On 2026-05-19 17:18 +0200, Jonas Karlman wrote: >> Hello Luca, >> >> On 5/19/2026 2:06 PM, Luca Ceresoli wrote: >>> On Mon, 18 May 2026 18:01:40 +0000, Jonas Karlman <[email protected]> wrote: >>> >>> Hello Jonas, >>> >>>> >>>> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c >>>> b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c >>>> index b7bfc0e9a6b2..9d795c550f8a 100644 >>>> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c >>>> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c >>>> @@ -2600,10 +2609,14 @@ static int dw_hdmi_connector_create(struct dw_hdmi >>>> *hdmi) >>>> >>>> drm_connector_helper_add(connector, &dw_hdmi_connector_helper_funcs); >>>> >>>> - drm_connector_init_with_ddc(hdmi->bridge.dev, connector, >>>> - &dw_hdmi_connector_funcs, >>>> - DRM_MODE_CONNECTOR_HDMIA, >>>> - hdmi->ddc); >>>> + ret = drm_connector_init_with_ddc(hdmi->bridge.dev, connector, >>>> + &dw_hdmi_connector_funcs, >>>> + DRM_MODE_CONNECTOR_HDMIA, >>>> + hdmi->ddc); >>>> + if (ret) >>>> + return ret; >>>> + >>>> + drm_bridge_get(&hdmi->bridge); >>> >>> I'm not fully following the code paths, but both the report and the fix >>> make sense to me. Only I'd move the drm_bridge_get() before >>> drm_connector_init_with_ddc(), to avoid a short window where no reference >>> is held and the bridge might be destroyed before drm_bridge_get() is >>> called. I'm not sure this can happen, but it's better to write the code in >>> a way that clearly makes it impossible. >> >> dw_hdmi_connector_create() is only called from dw_hdmi_bridge_attach() >> so the bridge should already have a ref for the lifetime of this call. > > Ah, that's true. So the patch is correct. > > Reviewed-by: Luca Ceresoli <[email protected]>
Thanks. > In case you send a new iteration, please add this extra explanation to the > commit message, similar to the above paragraph. Sure, I will include a note about this if/when I need to re-spin. >> I explicitly chose the placement after drm_connector_init_with_ddc() >> to ensure ref count is correctly balanced without having to add a >> drm_bridge_put() call in any error path. I.e. connector destroy() is >> only called when drm_connector_init_with_ddc() succeeds. >> >> This code/call is also planned to be removed in a future series, > > In order to remove the !DRM_BRIDGE_ATTACH_NO_CONNECTOR case? That would be > welcome! That would be an end goal, however initial plan/step was to just change to use drm_bridge_connector_init() inside this driver [1] or possible move that to the consuming driver (imx6, rockchip and sun8i), in an unpolished future series [2]. Fully change to use ATTACH_NO_CONNECTOR for those affected drivers may possibly be pushed to a follow-up future series. Main end goal of my current effort is to enable support for Deep Color and YCbCr output modes on Rockchip RK32xx/RK33xx/RK356x devices [3]. [1] https://github.com/Kwiboo/linux-rockchip/commit/813b55961e5a8fa864ea157e2793e76ca4967bac [2] https://github.com/Kwiboo/linux-rockchip/compare/7e9084cc75011ce28b1ceafec804091438eed1ff...3b5507aa260eb8306554c34a0c362e514ea41c3b [3] https://github.com/Kwiboo/linux-rockchip/commits/next-20260518-rk-hdmi-v5/ Regards, Jonas > > Luca >
