From 1302c66a228550482a2f9a58650d8c7eba1c5353 Mon Sep 17 00:00:00 2001 From: ChiHun Won Date: Sat, 7 Jul 2018 12:29:58 +0900 Subject: [PATCH] fbdev: dpu20: fixed dpu null pointer exception Change-Id: I27906b12ddecec8744e8ab56561f13e23c8f9a25 Signed-off-by: ChiHun Won --- drivers/video/fbdev/exynos/dpu20/dsim_drv.c | 7 +++++-- drivers/video/fbdev/exynos/dpu20/fence.c | 10 +++++++--- drivers/video/fbdev/exynos/dpu20/helper.c | 18 ++++++++++++++---- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/drivers/video/fbdev/exynos/dpu20/dsim_drv.c b/drivers/video/fbdev/exynos/dpu20/dsim_drv.c index db0f8f477fa8..0342404fa90b 100644 --- a/drivers/video/fbdev/exynos/dpu20/dsim_drv.c +++ b/drivers/video/fbdev/exynos/dpu20/dsim_drv.c @@ -424,15 +424,18 @@ static void dsim_bts_print_info(struct bts_decon_info *info) static void dsim_underrun_info(struct dsim_device *dsim) { #if defined(CONFIG_EXYNOS_BTS) - struct decon_device *decon; int i, decon_cnt; + struct decon_device *decon = get_decon_drvdata(0); dsim_info("\tMIF(%lu), INT(%lu), DISP(%lu)\n", cal_dfs_get_rate(ACPM_DVFS_MIF), cal_dfs_get_rate(ACPM_DVFS_INT), cal_dfs_get_rate(ACPM_DVFS_DISP)); - decon_cnt = get_decon_drvdata(0)->dt.decon_cnt; + if (decon == NULL) + return; + + decon_cnt = decon->dt.decon_cnt; for (i = 0; i < decon_cnt; ++i) { decon = get_decon_drvdata(i); diff --git a/drivers/video/fbdev/exynos/dpu20/fence.c b/drivers/video/fbdev/exynos/dpu20/fence.c index 14d4132a8667..9ff08bed09ef 100644 --- a/drivers/video/fbdev/exynos/dpu20/fence.c +++ b/drivers/video/fbdev/exynos/dpu20/fence.c @@ -299,8 +299,12 @@ void decon_wait_fence(struct dma_fence *fence) void decon_signal_fence(struct dma_fence *fence) { - if (dma_fence_signal(fence)) - decon_warn("%s: fence[%p] #%d signal failed\n", __func__, - fence, fence->seqno); + if (dma_fence_signal(fence)) { + if (fence) + decon_warn("%s: fence[%p] #%d signal failed\n", __func__, + fence, fence->seqno); + else + decon_warn("%s: fence is null\n", __func__); + } } #endif diff --git a/drivers/video/fbdev/exynos/dpu20/helper.c b/drivers/video/fbdev/exynos/dpu20/helper.c index 5405128cffdc..a8c1bc26870a 100644 --- a/drivers/video/fbdev/exynos/dpu20/helper.c +++ b/drivers/video/fbdev/exynos/dpu20/helper.c @@ -725,8 +725,18 @@ int dpu_pm_domain_check_status(struct exynos_pm_domain *pm_domain) void dsim_to_regs_param(struct dsim_device *dsim, struct dsim_regs *regs) { - regs->regs = dsim->res.regs; - regs->ss_regs = dsim->res.ss_regs; - regs->phy_regs = dsim->res.phy_regs; - regs->phy_regs_ex = dsim->res.phy_regs_ex; + if (dsim->res.regs) + regs->regs = dsim->res.regs; + else + regs->regs = NULL; + + if (dsim->res.phy_regs) + regs->phy_regs = dsim->res.phy_regs; + else + regs->phy_regs = NULL; + + if (dsim->res.phy_regs_ex) + regs->phy_regs_ex = dsim->res.phy_regs_ex; + else + regs->phy_regs_ex = NULL; } -- 2.20.1