From: Mark Yao Date: Mon, 24 Jul 2017 01:47:19 +0000 (+0800) Subject: drm/rockchip: backlight: fix null pointer error X-Git-Tag: release-20171130_firefly~4^2~115 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d26cbbbdb0ce7aa8a34a5f446e0141250c8cce7d;p=firefly-linux-kernel-4.4.55.git drm/rockchip: backlight: fix null pointer error drm backlight maybe not enabled, the private->backlight can be null pointer. [ 1.842225] PC is at rockchip_drm_backlight_update+0x14/0xd0 [ 1.842733] LR is at rockchip_atomic_commit_complete+0x34/0x70 [ 2.012457] [] rockchip_drm_backlight_update+0x14/0xd0 [ 2.013057] [] rockchip_atomic_commit_complete+0x34/0x70 [ 2.013666] [] rockchip_drm_atomic_commit+0x7c/0x9c [ 2.014244] [] drm_atomic_commit+0x64/0x70 [ 2.014747] [] show_loader_logo+0x83c/0x944 [ 2.015260] [] rockchip_drm_bind+0x388/0x418 [ 2.015783] [] try_to_bring_up_master.part.3+0xac/0x114 [ 2.016390] [] component_master_add_with_match+0xc8/0x124 [ 2.017010] [] rockchip_drm_platform_probe+0x208/0x238 [ 2.017609] [] platform_drv_probe+0x58/0xa4 [ 2.018123] [] driver_probe_device+0x118/0x2ac [ 2.018656] [] __device_attach_driver+0x88/0x98 [ 2.019200] [] bus_for_each_drv+0x7c/0xac [ 2.019702] [] __device_attach+0xa4/0x124 [ 2.020204] [] device_initial_probe+0x10/0x18 [ 2.020737] [] bus_probe_device+0x2c/0x8c [ 2.021238] [] deferred_probe_work_func+0x74/0xa0 [ 2.021795] [] process_one_work+0x218/0x3e0 [ 2.022307] [] worker_thread+0x2e8/0x404 [ 2.022797] [] kthread+0xf8/0x100 [ 2.023235] [] ret_from_fork+0x10/0x50 Change-Id: Ib77e871402dfcb1276befa274fc3cf43b017d879 Signed-off-by: Mark Yao --- diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_backlight.c b/drivers/gpu/drm/rockchip/rockchip_drm_backlight.c index 8380b8c8ee62..21a743052cb0 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_backlight.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_backlight.c @@ -204,15 +204,17 @@ void rockchip_drm_backlight_update(struct drm_device *drm) { struct rockchip_drm_private *private = drm->dev_private; struct rockchip_drm_backlight *bl = private->backlight; - struct drm_connector *connector = bl->connector; - struct sub_backlight *sub = bl->sub; + struct drm_connector *connector; + struct sub_backlight *sub; struct rockchip_crtc_state *s; struct drm_crtc *crtc; bool backlight_changed = false; - if (!connector) + if (!bl || !bl->connector) return; + sub = bl->sub; + connector = bl->connector; crtc = connector->state->crtc; if (!crtc) { if (sub) {