diff mbox

drm: Initialize list in event->base.link

Message ID 1371242346-3141-1-git-send-email-marcheu@chromium.org (mailing list archive)
State New, archived
Headers show

Commit Message

Stéphane Marchesin June 14, 2013, 8:39 p.m. UTC
The structure was kzalloced, so prev == next == NULL by default which
is invalid.

Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
---
 drivers/gpu/drm/drm_irq.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Daniel Vetter June 15, 2013, 7:07 p.m. UTC | #1
On Fri, Jun 14, 2013 at 01:39:05PM -0700, Stéphane Marchesin wrote:
> The structure was kzalloced, so prev == next == NULL by default which
> is invalid.
> 
> Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>

We do a list_add_tail which doesn't seem to care about unitizalized list
items, and when removing it we also use list_del and not list_del_init. So
I don't think we actually need this, neither for correctness nor for
consitency. Or am I missing something?
-Daniel

> ---
>  drivers/gpu/drm/drm_irq.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
> index 8bcce78..143a311 100644
> --- a/drivers/gpu/drm/drm_irq.c
> +++ b/drivers/gpu/drm/drm_irq.c
> @@ -1158,6 +1158,7 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
>  	e->event.base.length = sizeof e->event;
>  	e->event.user_data = vblwait->request.signal;
>  	e->base.event = &e->event.base;
> +	INIT_LIST_HEAD(&e->base.link);
>  	e->base.file_priv = file_priv;
>  	e->base.destroy = (void (*) (struct drm_pending_event *)) kfree;
>  
> -- 
> 1.8.3
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie June 16, 2013, 8:15 a.m. UTC | #2
On Sun, Jun 16, 2013 at 5:07 AM, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Fri, Jun 14, 2013 at 01:39:05PM -0700, Stéphane Marchesin wrote:
>> The structure was kzalloced, so prev == next == NULL by default which
>> is invalid.
>>
>> Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
>
> We do a list_add_tail which doesn't seem to care about unitizalized list
> items, and when removing it we also use list_del and not list_del_init. So
> I don't think we actually need this, neither for correctness nor for
> consitency. Or am I missing something?

I was going to say the same thing.

Dave.
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 8bcce78..143a311 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -1158,6 +1158,7 @@  static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
 	e->event.base.length = sizeof e->event;
 	e->event.user_data = vblwait->request.signal;
 	e->base.event = &e->event.base;
+	INIT_LIST_HEAD(&e->base.link);
 	e->base.file_priv = file_priv;
 	e->base.destroy = (void (*) (struct drm_pending_event *)) kfree;