Re: list corruption on removal of snd_seq_dummy

From: Dave Jones
Date: Mon Jun 26 2006 - 23:27:22 EST


On Fri, Jun 23, 2006 at 12:47:46PM +0200, Takashi Iwai wrote:

> > The code in question is doing..
> >
> > __list_add(&deleted_list,
> > client->ports_list_head.prev,
> > client->ports_list_head.next);
> >
> > which looks fishy, as those two elements aren't going to be consecutive,
> > as __list_add expects.
>
> I think the code behaves correctly but probably misusing __list_add().
> It movies the whole entries from an existing list_head A
> (clients->ports_list_head) to a new list_head B (deleted_list).
> The above is exapnded:
>
> A->next->prev = B;
> B->next = A->next;
> B->prev = A->prev;
> A->prev->next = B;
>
> Any better way to achieve it using standard macros?

Why can't you just list_move() the elements ?

Dave

--
http://www.codemonkey.org.uk
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/