Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b176e313 authored by Ritesh Kumar's avatar Ritesh Kumar
Browse files

drm: msm: dsi-staging: Fix error handling in case of EPROBE_DEFER



When mdss pll probe fails with status EPROBE_DEFER, mdss pll probe is
called again and frees dfps data memory again causing the double free
and the crash. To avoid this, parse dfps data memory when mdss pll
probe is successful.

When devm_clk_get returns error in dsi_ctrl_clocks_init, initialise the
clk to NULL to avoid NULL pointer dereference in dsi_ctrl_clocks_deinit.

Change-Id: I4179b711f70c033729a3c8a57f93737e414bd02c
Signed-off-by: default avatarRitesh Kumar <riteshk@codeaurora.org>
parent 068f5a8d
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
/* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -337,7 +337,7 @@ static void mdss_pll_free_bootmem(u32 mem_addr, u32 size)
		free_reserved_page(pfn_to_page(pfn_idx));
}

static int mdss_pll_util_parse_dt_dfps(struct platform_device *pdev,
static int mdss_pll_util_parse_dt_dfps_sub(struct platform_device *pdev,
					struct mdss_pll_resources *pll_res)
{
	int rc = 0;
@@ -424,9 +424,6 @@ int mdss_pll_util_resource_parse(struct platform_device *pdev,
		goto clk_err;
	}

	if (mdss_pll_util_parse_dt_dfps(pdev, pll_res))
		pr_err("dfps not enabled!\n");

	return rc;

clk_err:
@@ -435,3 +432,13 @@ int mdss_pll_util_resource_parse(struct platform_device *pdev,
end:
	return rc;
}

void mdss_pll_util_parse_dt_dfps(struct platform_device *pdev,
				struct mdss_pll_resources *pll_res)
{
	int rc = 0;

	rc = mdss_pll_util_parse_dt_dfps_sub(pdev, pll_res);
	if (rc)
		pr_err("dfps not enabled!\n");
}
+3 −1
Original line number Diff line number Diff line
/* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -366,6 +366,8 @@ static int mdss_pll_probe(struct platform_device *pdev)
		goto clock_register_error;
	}

	mdss_pll_util_parse_dt_dfps(pdev, pll_res);

	return rc;

clock_register_error:
+2 −0
Original line number Diff line number Diff line
@@ -251,6 +251,8 @@ int mdss_pll_util_resource_enable(struct mdss_pll_resources *pll_res,
								bool enable);
int mdss_pll_util_resource_parse(struct platform_device *pdev,
				struct mdss_pll_resources *pll_res);
void mdss_pll_util_parse_dt_dfps(struct platform_device *pdev,
				struct mdss_pll_resources *pll_res);
struct dss_vreg *mdss_pll_get_mp_by_reg_name(struct mdss_pll_resources *pll_res
		, char *name);
#endif
+5 −0
Original line number Diff line number Diff line
@@ -577,6 +577,7 @@ static int dsi_ctrl_clocks_init(struct platform_device *pdev,
	if (IS_ERR(hs_link->byte_clk)) {
		rc = PTR_ERR(hs_link->byte_clk);
		pr_err("failed to get byte_clk, rc=%d\n", rc);
		hs_link->byte_clk = NULL;
		goto fail;
	}

@@ -584,6 +585,7 @@ static int dsi_ctrl_clocks_init(struct platform_device *pdev,
	if (IS_ERR(hs_link->pixel_clk)) {
		rc = PTR_ERR(hs_link->pixel_clk);
		pr_err("failed to get pixel_clk, rc=%d\n", rc);
		hs_link->pixel_clk = NULL;
		goto fail;
	}

@@ -591,6 +593,7 @@ static int dsi_ctrl_clocks_init(struct platform_device *pdev,
	if (IS_ERR(lp_link->esc_clk)) {
		rc = PTR_ERR(lp_link->esc_clk);
		pr_err("failed to get esc_clk, rc=%d\n", rc);
		lp_link->esc_clk = NULL;
		goto fail;
	}

@@ -604,6 +607,7 @@ static int dsi_ctrl_clocks_init(struct platform_device *pdev,
	if (IS_ERR(rcg->byte_clk)) {
		rc = PTR_ERR(rcg->byte_clk);
		pr_err("failed to get byte_clk_rcg, rc=%d\n", rc);
		rcg->byte_clk = NULL;
		goto fail;
	}

@@ -611,6 +615,7 @@ static int dsi_ctrl_clocks_init(struct platform_device *pdev,
	if (IS_ERR(rcg->pixel_clk)) {
		rc = PTR_ERR(rcg->pixel_clk);
		pr_err("failed to get pixel_clk_rcg, rc=%d\n", rc);
		rcg->pixel_clk = NULL;
		goto fail;
	}