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

Commit 47f2404c authored by Casey Piper's avatar Casey Piper
Browse files

msm: mdss: Account for null ctl passed to line count



Line count could be passed a null ctl structure,
which would cause a kernel panic. To prevent this,
line count will just return 0 if a null parameter
is passed.

Change-Id: I2b52533e6b67b842542de5b81be5b43fccc364dc
CRs-Fixed: 551701
Signed-off-by: default avatarCasey Piper <cpiper@codeaurora.org>
parent e9b95d32
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -78,11 +78,15 @@ static inline u32 mdp_video_read(struct mdss_mdp_video_ctx *ctx,

static inline u32 mdss_mdp_video_line_count(struct mdss_mdp_ctl *ctl)
{
	struct mdss_mdp_video_ctx *ctx = ctl->priv_data;
	struct mdss_mdp_video_ctx *ctx;
	u32 line_cnt = 0;
	if (!ctl || !ctl->priv_data)
		goto line_count_exit;
	ctx = ctl->priv_data;
	mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_ON, false);
	line_cnt = mdp_video_read(ctx, MDSS_MDP_REG_INTF_LINE_COUNT);
	mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_OFF, false);
line_count_exit:
	return line_cnt;
}