From ef073667490dc0b619ba13e0bdf4f68f09162b2f Mon Sep 17 00:00:00 2001 From: Mark Yao Date: Wed, 8 Nov 2017 15:49:13 +0800 Subject: [PATCH] drm/rockchip: vop: fix null pointer on bandwidth check [ 56.320811] Unable to handle kernel NULL pointer dereference at virtual address 0000007f [ 56.330006] pgd = d675c000 [ 56.333019] [0000007f] *pgd=00000000 [ 56.337209] Internal error: Oops: 5 [#1] SMP ARM [ 56.342354] Modules linked in: [ 56.345774] CPU: 0 PID: 825 Comm: mppvideodec0:sr Not tainted 4.4.93 #194 [ 56.353302] Hardware name: Generic DT based system [ 56.353309] task: d6778700 task.stack: c7806000 [ 56.353337] PC is at vop_crtc_bandwidth+0x278/0x3fc [ 56.353347] LR is at irq_work_queue+0x4c/0x84 [ 56.353354] pc : [] lr : [] psr: 60010013 [ 56.353354] sp : c7807c90 ip : 00000002 fp : c7807cec [ 56.353358] r10: d65d5340 r9 : 00000000 r8 : d65d5540 [ 56.353364] r7 : 000001dd r6 : 000010fb r5 : 00002672 r4 : 00000001 [ 56.353368] r3 : c0c57aa8 r2 : 00000000 r1 : dfbc63c8 r0 : 00000025 [ 56.353375] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none [ 56.353380] Control: 10c5387d Table: 7675c06a DAC: 00000051 [ 56.354555] [] (vop_crtc_bandwidth) from [] (rockchip_drm_atomic_commit+0xc0/0x180) [ 56.354571] [] (rockchip_drm_atomic_commit) from [] (drm_atomic_commit+0x64/0x7c) [ 56.354587] [] (drm_atomic_commit) from [] (drm_atomic_helper_update_plane+0xc8/0x10c) [ 56.354604] [] (drm_atomic_helper_update_plane) from [] (__setplane_internal+0x1b4/0x218) [ 56.354615] [] (__setplane_internal) from [] (drm_mode_setplane+0x158/0x190) [ 56.354629] [] (drm_mode_setplane) from [] (drm_ioctl+0x26c/0x404) [ 56.354644] [] (drm_ioctl) from [] (do_vfs_ioctl+0x564/0x68c) [ 56.354658] [] (do_vfs_ioctl) from [] (SyS_ioctl+0x5c/0x84) [ 56.354672] [] (SyS_ioctl) from [] (ret_fast_syscall+0x0/0x3c) Change-Id: I7dc999e0f438b18af77dc9885ebc71745b6ac94b Signed-off-by: Mark Yao Reported-by: Caesar Wang --- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index 811b59c023c3..80c7b9133050 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -59,7 +59,8 @@ VOP_REG_SUPPORT(vop, win->phy->name) #define VOP_WIN_SCL_EXT_SUPPORT(vop, win, name) \ - VOP_REG_SUPPORT(vop, win->phy->scl->ext->name) + (win->phy->scl->ext && \ + VOP_REG_SUPPORT(vop, win->phy->scl->ext->name)) #define VOP_CTRL_SUPPORT(vop, name) \ VOP_REG_SUPPORT(vop, vop->data->ctrl->name)