未验证 提交 46f47807 编写于 作者: Y Yongzhi Liu 提交者: Robert Foss

drm/bridge: Add missing pm_runtime_put_sync

pm_runtime_get_sync() will increase the rumtime PM counter
even when it returns an error. Thus a pairing decrement is needed
to prevent refcount leak. Fix this by replacing this API with
pm_runtime_resume_and_get(), which will not change the runtime
PM counter on error. Besides, a matching decrement is needed
on the error handling path to keep the counter balanced.
Signed-off-by: NYongzhi Liu <lyz_cs@pku.edu.cn>
Reviewed-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: NRobert Foss <robert.foss@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1643008835-73961-1-git-send-email-lyz_cs@pku.edu.cn
上级 9d6bf794
...@@ -862,18 +862,19 @@ nwl_dsi_bridge_mode_set(struct drm_bridge *bridge, ...@@ -862,18 +862,19 @@ nwl_dsi_bridge_mode_set(struct drm_bridge *bridge,
memcpy(&dsi->mode, adjusted_mode, sizeof(dsi->mode)); memcpy(&dsi->mode, adjusted_mode, sizeof(dsi->mode));
drm_mode_debug_printmodeline(adjusted_mode); drm_mode_debug_printmodeline(adjusted_mode);
pm_runtime_get_sync(dev); if (pm_runtime_resume_and_get(dev) < 0)
return;
if (clk_prepare_enable(dsi->lcdif_clk) < 0) if (clk_prepare_enable(dsi->lcdif_clk) < 0)
return; goto runtime_put;
if (clk_prepare_enable(dsi->core_clk) < 0) if (clk_prepare_enable(dsi->core_clk) < 0)
return; goto runtime_put;
/* Step 1 from DSI reset-out instructions */ /* Step 1 from DSI reset-out instructions */
ret = reset_control_deassert(dsi->rst_pclk); ret = reset_control_deassert(dsi->rst_pclk);
if (ret < 0) { if (ret < 0) {
DRM_DEV_ERROR(dev, "Failed to deassert PCLK: %d\n", ret); DRM_DEV_ERROR(dev, "Failed to deassert PCLK: %d\n", ret);
return; goto runtime_put;
} }
/* Step 2 from DSI reset-out instructions */ /* Step 2 from DSI reset-out instructions */
...@@ -883,13 +884,18 @@ nwl_dsi_bridge_mode_set(struct drm_bridge *bridge, ...@@ -883,13 +884,18 @@ nwl_dsi_bridge_mode_set(struct drm_bridge *bridge,
ret = reset_control_deassert(dsi->rst_esc); ret = reset_control_deassert(dsi->rst_esc);
if (ret < 0) { if (ret < 0) {
DRM_DEV_ERROR(dev, "Failed to deassert ESC: %d\n", ret); DRM_DEV_ERROR(dev, "Failed to deassert ESC: %d\n", ret);
return; goto runtime_put;
} }
ret = reset_control_deassert(dsi->rst_byte); ret = reset_control_deassert(dsi->rst_byte);
if (ret < 0) { if (ret < 0) {
DRM_DEV_ERROR(dev, "Failed to deassert BYTE: %d\n", ret); DRM_DEV_ERROR(dev, "Failed to deassert BYTE: %d\n", ret);
return; goto runtime_put;
} }
return;
runtime_put:
pm_runtime_put_sync(dev);
} }
static void static void
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册