include: drm: drm_atomic: Artificially use 'crtc' to avoid 'not used' warning
authorLee Jones <lee.jones@linaro.org>
Thu, 12 Nov 2020 19:00:11 +0000 (19:00 +0000)
committerSam Ravnborg <sam@ravnborg.org>
Thu, 12 Nov 2020 19:32:12 +0000 (20:32 +0100)
The precedent has already been set by other macros in the same file.

Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/vkms/vkms_drv.c:55:19: warning: variable ‘crtc’ set but not used [-Wunused-but-set-variable]
 55 | struct drm_crtc *crtc;
 | ^~~~

Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Rob Clark <robdclark@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201112190039.2785914-3-lee.jones@linaro.org
include/drm/drm_atomic.h

index 413fd0c..dc5e0fb 100644 (file)
@@ -802,6 +802,7 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);
             (__i)++)                                                   \
                for_each_if ((__state)->crtcs[__i].ptr &&               \
                             ((crtc) = (__state)->crtcs[__i].ptr,       \
+                            (void)(crtc) /* Only to avoid unused-but-set-variable warning */, \
                             (old_crtc_state) = (__state)->crtcs[__i].old_state, 1))
 
 /**