Message ID | 20181129203652.223634-1-sean@poorly.run (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm: Fix compiler warning in drm_atomic_helper.c | expand |
On Thu, Nov 29, 2018 at 03:36:48PM -0500, Sean Paul wrote: > From: Sean Paul <seanpaul@chromium.org> > > 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. > > Fixes: b7ea04d299c7 ("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 > Signed-off-by: Sean Paul <seanpaul@chromium.org> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> > --- > 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); > -- > Sean Paul, Software Engineer, Google / Chromium OS >
On Fri, Nov 30, 2018 at 4:48 AM Daniel Vetter <daniel@ffwll.ch> wrote: > > On Thu, Nov 29, 2018 at 03:36:48PM -0500, Sean Paul wrote: > > From: Sean Paul <seanpaul@chromium.org> > > > > 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. > > > > Fixes: b7ea04d299c7 ("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 > > Signed-off-by: Sean Paul <seanpaul@chromium.org> > > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> > Thanks for the review, I've pushed it to drm-misc-next with a more detailed commit message including kbuild link/configuration (upon Dave's suggestion). Sean > > --- > > 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); > > -- > > Sean Paul, Software Engineer, Google / Chromium OS > > > > -- > Daniel Vetter > Software Engineer, Intel Corporation > http://blog.ffwll.ch
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);