diff options
| author | Nirmal Abraham <nabrah@codeaurora.org> | 2019-08-01 10:34:40 +0530 |
|---|---|---|
| committer | Nirmal Abraham <nabrah@codeaurora.org> | 2019-08-01 11:23:35 +0530 |
| commit | 3dd5febeecd16e8288fde355ced4526c7baf11bd (patch) | |
| tree | ac516a1f25b03b71ab863bdc75ce73c788345395 | |
| parent | 80cb08efce94fb197b05bc1c9dfaeb72a765eb96 (diff) | |
fbdev: msm: Call vsync_handler only after ctl start
In hdmi-as-primary usecase with resolution change, the
vsync_handler can get called from overlay_on function before
the vsync handler is registered via ctl_start. Add a check
to avoid the null ptr access while accessing the vsync
handler function ptr in this case.
Change-Id: Ic47b10502939c4a4751c78da1f8fe28b3005cf3b
Signed-off-by: Nirmal Abraham <nabrah@codeaurora.org>
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_mdp_overlay.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/video/fbdev/msm/mdss_mdp_overlay.c b/drivers/video/fbdev/msm/mdss_mdp_overlay.c index 324e5e9ca60d..daeed5d45072 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_overlay.c +++ b/drivers/video/fbdev/msm/mdss_mdp_overlay.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-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 @@ -5762,12 +5762,14 @@ static int mdss_mdp_overlay_on(struct msm_fb_data_type *mfd) panel_on: if (mdp5_data->vsync_en) { - pr_info("reenabling vsync for fb%d\n", mfd->index); - mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_ON); - rc = ctl->ops.add_vsync_handler(ctl, &ctl->vsync_handler); - mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_OFF); + if ((ctl) && (ctl->ops.add_vsync_handler)) { + pr_info("reenabling vsync for fb%d\n", mfd->index); + mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_ON); + rc = ctl->ops.add_vsync_handler(ctl, + &ctl->vsync_handler); + mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_OFF); + } } - if (IS_ERR_VALUE(rc)) { pr_err("Failed to turn on fb%d\n", mfd->index); mdss_mdp_overlay_off(mfd); |
