diff options
author | Alban Bedel <alban.bedel@avionic-design.de> | 2015-05-12 13:58:51 +0530 |
---|---|---|
committer | Matthew Pedro <mapedro@nvidia.com> | 2015-05-19 11:04:46 -0700 |
commit | afa0e03b25cc6107ac9882d91f5aee233840e92d (patch) | |
tree | fc00760334bc7ff48d721069a6c1ce6e6a2148bc /drivers/video/tegra | |
parent | 909e29cb3cf1f71cf0579f5d9df029c16c8b7dbb (diff) |
video: tegra: hdmi: Fix potential crash when setting up HDMI
The HDMI state machine registers an IRQ handler before all the resources
it needs are available. Ideally the IRQ handler should be registered
later, however it would mean a quite large change. Instead we just add
some check to avoid running the state machine as long as the
framebuffer hasn't been registered.
While at it also prevent scheduling the state machine if it hasn't been
initialized yet.
Bug 1618089
Change-Id: I8f9dc07d2a4bf7e33e869206ad83ed80af93f566
Signed-off-by: Alban Bedel <alban.bedel@avionic-design.de>
Signed-off-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-on: http://git-master/r/741616
GVS: Gerrit_Virtual_Submit
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>
Diffstat (limited to 'drivers/video/tegra')
-rw-r--r-- | drivers/video/tegra/dc/hdmi_state_machine.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/video/tegra/dc/hdmi_state_machine.c b/drivers/video/tegra/dc/hdmi_state_machine.c index 5389ff17b42c..87704e6c83c5 100644 --- a/drivers/video/tegra/dc/hdmi_state_machine.c +++ b/drivers/video/tegra/dc/hdmi_state_machine.c @@ -465,6 +465,13 @@ static void hdmi_state_machine_worker(struct work_struct *work) { int pending_hpd_evt, cur_hpd; + /* Check if the DC and FB are setup, if not just abort */ + if (!work_state.hdmi->dc || !work_state.hdmi->dc->fb) { + pr_warn("%s (tid %p): %s is not yet set!\n", + __func__, current, work_state.hdmi->dc ? "FB" : "DC"); + return; + } + /* Observe and clear the pending flag and latch the current HPD state. */ rt_mutex_lock(&work_lock); @@ -522,8 +529,11 @@ void hdmi_state_machine_set_pending_hpd(void) rt_mutex_lock(&work_lock); /* We always schedule work any time there is a pending HPD event */ - work_state.pending_hpd_evt = 1; - hdmi_state_machine_sched_work_l(0); + /* But only if the state machine has been inited */ + if (unlikely(work_state.hdmi)) { + work_state.pending_hpd_evt = 1; + hdmi_state_machine_sched_work_l(0); + } rt_mutex_unlock(&work_lock); } |