summaryrefslogtreecommitdiff
path: root/drivers/media/platform
diff options
context:
space:
mode:
authorKangjie Lu <kjlu@umn.edu>2019-03-23 05:51:06 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-07-26 10:14:00 +0300
commit6fb470ace862bbadb756b178019d496b10fa01cc (patch)
tree3fcb06ba225f7ad89b86e6c426717d10bd85ed02 /drivers/media/platform
parent70da38e8050920c833826c41f9cc06aa5e43ebdd (diff)
downloadlinux-6fb470ace862bbadb756b178019d496b10fa01cc.tar.xz
media: vpss: fix a potential NULL pointer dereference
[ Upstream commit e08f0761234def47961d3252eac09ccedfe4c6a0 ] In case ioremap fails, the fix returns -ENOMEM to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu <kjlu@umn.edu> Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Reviewed-by: Mukesh Ojha <mojha@codeaurora.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/media/platform')
-rw-r--r--drivers/media/platform/davinci/vpss.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/media/platform/davinci/vpss.c b/drivers/media/platform/davinci/vpss.c
index 19cf6853411e..89a86c19579b 100644
--- a/drivers/media/platform/davinci/vpss.c
+++ b/drivers/media/platform/davinci/vpss.c
@@ -518,6 +518,11 @@ static int __init vpss_init(void)
return -EBUSY;
oper_cfg.vpss_regs_base2 = ioremap(VPSS_CLK_CTRL, 4);
+ if (unlikely(!oper_cfg.vpss_regs_base2)) {
+ release_mem_region(VPSS_CLK_CTRL, 4);
+ return -ENOMEM;
+ }
+
writel(VPSS_CLK_CTRL_VENCCLKEN |
VPSS_CLK_CTRL_DACCLKEN, oper_cfg.vpss_regs_base2);