From: Chris Wilson Date: Sun, 27 Nov 2016 17:09:09 +0000 (+0000) Subject: drm: Avoid NULL dereference for DRM_LEGACY debug message X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a2ec1c132a593ac4f05eb8d02834c4675a4aea07;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git drm: Avoid NULL dereference for DRM_LEGACY debug message smatch warns: drivers/gpu/drm/drm_lock.c:188 drm_legacy_lock() warn: variable dereferenced before check 'master->lock.hw_lock' (see line 177) Signed-off-by: Chris Wilson Signed-off-by: Daniel Vetter Link: http://patchwork.freedesktop.org/patch/msgid/20161127170910.29106-2-chris@chris-wilson.co.uk --- diff --git a/drivers/gpu/drm/drm_lock.c b/drivers/gpu/drm/drm_lock.c index c901f3c5b269..32d43f86a8f2 100644 --- a/drivers/gpu/drm/drm_lock.c +++ b/drivers/gpu/drm/drm_lock.c @@ -176,7 +176,8 @@ int drm_legacy_lock(struct drm_device *dev, void *data, DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n", lock->context, task_pid_nr(current), - master->lock.hw_lock->lock, lock->flags); + master->lock.hw_lock ? master->lock.hw_lock->lock : -1, + lock->flags); add_wait_queue(&master->lock.lock_queue, &entry); spin_lock_bh(&master->lock.spinlock);