* [PATCH] drm/atomic: Initialize variables in drm_atomic_helper_async_check() to make gcc happy
@ 2018-07-23 13:59 Boris Brezillon
2018-07-23 14:09 ` Sean Paul
0 siblings, 1 reply; 3+ messages in thread
From: Boris Brezillon @ 2018-07-23 13:59 UTC (permalink / raw)
To: David Airlie, Daniel Vetter, dri-devel; +Cc: Boris Brezillon
drm_atomic_helper_async_check() declares the plane, old_plane_state and
new_plane_state variables to iterate over all planes of the atomic
state and make sure only one plane is enabled.
Unfortunately gcc is not smart enough to figure out that the check on
n_planes is enough to guarantee that plane, new_plane_state and
old_plane_state are initialized.
Explicitly initialized those variables to NULL to make gcc happy.
Fixes: fef9df8b5945 ("drm/atomic: initial support for asynchronous plane update")
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
---
drivers/gpu/drm/drm_atomic_helper.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index f7ccfebd3ca8..80be74df7ba6 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1538,8 +1538,9 @@ int drm_atomic_helper_async_check(struct drm_device *dev,
{
struct drm_crtc *crtc;
struct drm_crtc_state *crtc_state;
- struct drm_plane *plane;
- struct drm_plane_state *old_plane_state, *new_plane_state;
+ struct drm_plane *plane = NULL;
+ struct drm_plane_state *old_plane_state = NULL;
+ struct drm_plane_state *new_plane_state = NULL;
const struct drm_plane_helper_funcs *funcs;
int i, n_planes = 0;
--
2.14.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] drm/atomic: Initialize variables in drm_atomic_helper_async_check() to make gcc happy
2018-07-23 13:59 [PATCH] drm/atomic: Initialize variables in drm_atomic_helper_async_check() to make gcc happy Boris Brezillon
@ 2018-07-23 14:09 ` Sean Paul
2018-07-23 14:17 ` Boris Brezillon
0 siblings, 1 reply; 3+ messages in thread
From: Sean Paul @ 2018-07-23 14:09 UTC (permalink / raw)
To: Boris Brezillon; +Cc: David Airlie, dri-devel
On Mon, Jul 23, 2018 at 03:59:02PM +0200, Boris Brezillon wrote:
> drm_atomic_helper_async_check() declares the plane, old_plane_state and
> new_plane_state variables to iterate over all planes of the atomic
> state and make sure only one plane is enabled.
>
> Unfortunately gcc is not smart enough to figure out that the check on
> n_planes is enough to guarantee that plane, new_plane_state and
> old_plane_state are initialized.
>
> Explicitly initialized those variables to NULL to make gcc happy.
Reviewed-by: Sean Paul <seanpaul@chromium.org>
>
> Fixes: fef9df8b5945 ("drm/atomic: initial support for asynchronous plane update")
> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
> ---
> drivers/gpu/drm/drm_atomic_helper.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index f7ccfebd3ca8..80be74df7ba6 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -1538,8 +1538,9 @@ int drm_atomic_helper_async_check(struct drm_device *dev,
> {
> struct drm_crtc *crtc;
> struct drm_crtc_state *crtc_state;
> - struct drm_plane *plane;
> - struct drm_plane_state *old_plane_state, *new_plane_state;
> + struct drm_plane *plane = NULL;
> + struct drm_plane_state *old_plane_state = NULL;
> + struct drm_plane_state *new_plane_state = NULL;
> const struct drm_plane_helper_funcs *funcs;
> int i, n_planes = 0;
>
> --
> 2.14.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] drm/atomic: Initialize variables in drm_atomic_helper_async_check() to make gcc happy
2018-07-23 14:09 ` Sean Paul
@ 2018-07-23 14:17 ` Boris Brezillon
0 siblings, 0 replies; 3+ messages in thread
From: Boris Brezillon @ 2018-07-23 14:17 UTC (permalink / raw)
To: Sean Paul; +Cc: David Airlie, dri-devel
On Mon, 23 Jul 2018 10:09:25 -0400
Sean Paul <seanpaul@chromium.org> wrote:
> On Mon, Jul 23, 2018 at 03:59:02PM +0200, Boris Brezillon wrote:
> > drm_atomic_helper_async_check() declares the plane, old_plane_state and
> > new_plane_state variables to iterate over all planes of the atomic
> > state and make sure only one plane is enabled.
> >
> > Unfortunately gcc is not smart enough to figure out that the check on
> > n_planes is enough to guarantee that plane, new_plane_state and
> > old_plane_state are initialized.
> >
> > Explicitly initialized those variables to NULL to make gcc happy.
^ initialize
And I forgot to add
Cc: stable@vger.kernel.com
Will send a v2 soon.
>
> Reviewed-by: Sean Paul <seanpaul@chromium.org>
Thanks for the review.
>
> >
> > Fixes: fef9df8b5945 ("drm/atomic: initial support for asynchronous plane update")
> > Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
> > ---
> > drivers/gpu/drm/drm_atomic_helper.c | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> > index f7ccfebd3ca8..80be74df7ba6 100644
> > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > @@ -1538,8 +1538,9 @@ int drm_atomic_helper_async_check(struct drm_device *dev,
> > {
> > struct drm_crtc *crtc;
> > struct drm_crtc_state *crtc_state;
> > - struct drm_plane *plane;
> > - struct drm_plane_state *old_plane_state, *new_plane_state;
> > + struct drm_plane *plane = NULL;
> > + struct drm_plane_state *old_plane_state = NULL;
> > + struct drm_plane_state *new_plane_state = NULL;
> > const struct drm_plane_helper_funcs *funcs;
> > int i, n_planes = 0;
> >
> > --
> > 2.14.1
> >
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-07-23 14:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-23 13:59 [PATCH] drm/atomic: Initialize variables in drm_atomic_helper_async_check() to make gcc happy Boris Brezillon
2018-07-23 14:09 ` Sean Paul
2018-07-23 14:17 ` Boris Brezillon
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.