Skip to content

Commit

Permalink
drm: Fix compiler warning in drm_atomic_helper.c
Browse files Browse the repository at this point in the history
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:   b7ea04d
	commit: b7ea04d [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 b7ea04d
		# save the attached .config to linux build tree
		make ARCH=x86_64

Fixes: b7ea04d ("drm: Add DRM_MODESET_LOCK_BEGIN/END helpers")
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Sean Paul <sean@poorly.run>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
[seanpaul added extra details on airlied's suggestion]
Link: https://patchwork.freedesktop.org/patch/msgid/20181129203652.223634-1-sean@poorly.run
  • Loading branch information
Sean Paul committed Nov 30, 2018
1 parent f6d266c commit 615aa3d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/gpu/drm/drm_atomic_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 615aa3d

Please sign in to comment.