Commit 45dac135 authored by Miaoqian Lin's avatar Miaoqian Lin Committed by Abhinav Kumar
Browse files

drm/msm/dpu: Fix memory leak in msm_mdss_parse_data_bus_icc_path



of_icc_get() alloc resources for path1, we should release it when not
need anymore. Early return when IS_ERR_OR_NULL(path0) may leak path1.
Defer getting path1 to fix this.

Fixes: b9364eed ("drm/msm/dpu: Move min BW request and full BW disable back to mdss")
Signed-off-by: default avatarMiaoqian Lin <linmq006@gmail.com>
Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
Reviewed-by: default avatarAbhinav Kumar <quic_abhinavk@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/514264/
Link: https://lore.kernel.org/r/20221207065922.2086368-1-linmq006@gmail.com


Signed-off-by: default avatarAbhinav Kumar <quic_abhinavk@quicinc.com>
parent e5266ca3
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -47,15 +47,17 @@ struct msm_mdss {
static int msm_mdss_parse_data_bus_icc_path(struct device *dev,
					    struct msm_mdss *msm_mdss)
{
	struct icc_path *path0 = of_icc_get(dev, "mdp0-mem");
	struct icc_path *path1 = of_icc_get(dev, "mdp1-mem");
	struct icc_path *path0;
	struct icc_path *path1;

	path0 = of_icc_get(dev, "mdp0-mem");
	if (IS_ERR_OR_NULL(path0))
		return PTR_ERR_OR_ZERO(path0);

	msm_mdss->path[0] = path0;
	msm_mdss->num_paths = 1;

	path1 = of_icc_get(dev, "mdp1-mem");
	if (!IS_ERR_OR_NULL(path1)) {
		msm_mdss->path[1] = path1;
		msm_mdss->num_paths++;