diff mbox series

media: venus: core: Fix a potential NULL pointer dereference

Message ID 2235101c73ad1137685a8669bfab9a86d2bd9ec7.1632116708.git.christophe.jaillet@wanadoo.fr (mailing list archive)
State New, archived
Headers show
Series media: venus: core: Fix a potential NULL pointer dereference | expand

Commit Message

Christophe JAILLET Sept. 20, 2021, 5:46 a.m. UTC
According to the code in 'venus_runtime_suspend()' and
'venus_runtime_resume()', 'pm_ops->core_power' can be NULL.

So make the same assumption in the error handling path of
'venus_runtime_suspend()' and add the missing check. This can avoid a
potential NULL pointer dereference.

Fixes: 9e8efdb57879 ("media: venus: core: vote for video-mem path")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/media/platform/qcom/venus/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index 7e54c5d571dc..593d4cbe44e0 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -470,7 +470,8 @@  static __maybe_unused int venus_runtime_suspend(struct device *dev)
 err_video_path:
 	icc_set_bw(core->cpucfg_path, kbps_to_icc(1000), 0);
 err_cpucfg_path:
-	pm_ops->core_power(core, POWER_ON);
+	if (pm_ops->core_power)
+		pm_ops->core_power(core, POWER_ON);
 
 	return ret;
 }