From e4445f84779f61ecc3bd0107856034c95619347f Mon Sep 17 00:00:00 2001 From: Sean Paul Date: Thu, 29 Nov 2018 15:36:48 -0500 Subject: [PATCH] drm: Fix compiler warning in drm_atomic_helper.c Kbuild was complaining about: >> drivers/gpu/drm/drm_atomic_helper.c:3169:27: warning: 'state' may be used uninitialized in this function [-Wmaybe-uninitialized] Now state can't actually be used uninitialized, but we'll assign a value anyways so it stops bellyaching. Kbuild config: link: https://lists.01.org/pipermail/kbuild-all/2018-November/055374.html tree: git://anongit.freedesktop.org/drm/drm-misc for-linux-next head: e46462da2a7eec4243f3fd4ddf593fe498d900b3 commit: e46462da2a7eec4243f3fd4ddf593fe498d900b3 [4/4] drm: Add DRM_MODESET_LOCK_BEGIN/END helpers config: x86_64-randconfig-x017-201847 (attached as .config) compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce: git checkout e46462da2a7eec4243f3fd4ddf593fe498d900b3 # save the attached .config to linux build tree make ARCH=x86_64 Fixes: e46462da2a7e ("drm: Add DRM_MODESET_LOCK_BEGIN/END helpers") Cc: Daniel Vetter Cc: Sean Paul Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Sean Paul Cc: David Airlie Cc: dri-devel@lists.freedesktop.org Reviewed-by: Daniel Vetter Signed-off-by: Sean Paul [seanpaul added extra details on airlied's suggestion] Link: https://patchwork.freedesktop.org/patch/msgid/20181129203652.223634-1-sean@poorly.run --- drivers/gpu/drm/drm_atomic_helper.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 0d58c40aa4401..0ee83efeb94a4 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -3169,6 +3169,9 @@ struct drm_atomic_state *drm_atomic_helper_suspend(struct drm_device *dev) struct drm_atomic_state *state; int err; + /* This can never be returned, but it makes the compiler happy */ + state = ERR_PTR(-EINVAL); + DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, err); state = drm_atomic_helper_duplicate_state(dev, &ctx); -- 2.39.5