All of lore.kernel.org
 help / color / mirror / Atom feed
* snd_usb_endpoint_free
@ 2014-06-25  6:28 Julia Lawall
  2014-06-25  6:50 ` snd_usb_endpoint_free Julia Lawall
  0 siblings, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2014-06-25  6:28 UTC (permalink / raw)
  To: perex, tiwai, alsa-devel

The function snd_usb_endpoint_free in sound/usb/endpoint.c is defined as 
follows:

void snd_usb_endpoint_free(struct list_head *head)
{
        struct snd_usb_endpoint *ep;

        ep = list_entry(head, struct snd_usb_endpoint, list);
        release_urbs(ep, 1);
        kfree(ep);
}

I wonder if the final kfree should be list_del?  In practice, this 
function is only used from snd_usb_audio_disconnect in sound/usb/card.c 
where the entire list is destroyed, but it seems like quite a generic 
function that someone may someday want to use for just freeing one entry.

julia

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: snd_usb_endpoint_free
  2014-06-25  6:28 snd_usb_endpoint_free Julia Lawall
@ 2014-06-25  6:50 ` Julia Lawall
  2014-06-25 10:13   ` snd_usb_endpoint_free Daniel Mack
  0 siblings, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2014-06-25  6:50 UTC (permalink / raw)
  To: perex; +Cc: tiwai, alsa-devel



On Wed, 25 Jun 2014, Julia Lawall wrote:

> The function snd_usb_endpoint_free in sound/usb/endpoint.c is defined as 
> follows:
> 
> void snd_usb_endpoint_free(struct list_head *head)
> {
>         struct snd_usb_endpoint *ep;
> 
>         ep = list_entry(head, struct snd_usb_endpoint, list);
>         release_urbs(ep, 1);
>         kfree(ep);
> }
> 
> I wonder if the final kfree should be list_del?  In practice, this 

Sorry, the question should be "I wonder if this function should also use 
list_del", since list_del doesn't subsume kfree.

julia

> function is only used from snd_usb_audio_disconnect in sound/usb/card.c 
> where the entire list is destroyed, but it seems like quite a generic 
> function that someone may someday want to use for just freeing one entry.
> 
> julia
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: snd_usb_endpoint_free
  2014-06-25  6:50 ` snd_usb_endpoint_free Julia Lawall
@ 2014-06-25 10:13   ` Daniel Mack
  2014-06-25 10:16     ` snd_usb_endpoint_free Julia Lawall
  2014-06-25 12:33     ` snd_usb_endpoint_free Takashi Iwai
  0 siblings, 2 replies; 5+ messages in thread
From: Daniel Mack @ 2014-06-25 10:13 UTC (permalink / raw)
  To: Julia Lawall, perex; +Cc: tiwai, alsa-devel

Hi Julia,

On 06/25/2014 08:50 AM, Julia Lawall wrote:
> On Wed, 25 Jun 2014, Julia Lawall wrote:
>> The function snd_usb_endpoint_free in sound/usb/endpoint.c is defined as 
>> follows:
>>
>> void snd_usb_endpoint_free(struct list_head *head)
>> {
>>         struct snd_usb_endpoint *ep;
>>
>>         ep = list_entry(head, struct snd_usb_endpoint, list);
>>         release_urbs(ep, 1);
>>         kfree(ep);
>> }
>>
>> I wonder if the final kfree should be list_del?  In practice, this 
> 
> Sorry, the question should be "I wonder if this function should also use 
> list_del", since list_del doesn't subsume kfree.
> 
> julia
> 
>> function is only used from snd_usb_audio_disconnect in sound/usb/card.c 
>> where the entire list is destroyed, but it seems like quite a generic 
>> function that someone may someday want to use for just freeing one entry.

Jup, you're right, a list_del() in there wouldn't harm. However, it
currently wouldn't buy us anything either, and other functions we call
from snd_usb_audio_disconnect() for list members don't kill their own
list entry node themselves.


Thanks,
Daniel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: snd_usb_endpoint_free
  2014-06-25 10:13   ` snd_usb_endpoint_free Daniel Mack
@ 2014-06-25 10:16     ` Julia Lawall
  2014-06-25 12:33     ` snd_usb_endpoint_free Takashi Iwai
  1 sibling, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2014-06-25 10:16 UTC (permalink / raw)
  To: Daniel Mack; +Cc: tiwai, alsa-devel



On Wed, 25 Jun 2014, Daniel Mack wrote:

> Hi Julia,
>
> On 06/25/2014 08:50 AM, Julia Lawall wrote:
> > On Wed, 25 Jun 2014, Julia Lawall wrote:
> >> The function snd_usb_endpoint_free in sound/usb/endpoint.c is defined as
> >> follows:
> >>
> >> void snd_usb_endpoint_free(struct list_head *head)
> >> {
> >>         struct snd_usb_endpoint *ep;
> >>
> >>         ep = list_entry(head, struct snd_usb_endpoint, list);
> >>         release_urbs(ep, 1);
> >>         kfree(ep);
> >> }
> >>
> >> I wonder if the final kfree should be list_del?  In practice, this
> >
> > Sorry, the question should be "I wonder if this function should also use
> > list_del", since list_del doesn't subsume kfree.
> >
> > julia
> >
> >> function is only used from snd_usb_audio_disconnect in sound/usb/card.c
> >> where the entire list is destroyed, but it seems like quite a generic
> >> function that someone may someday want to use for just freeing one entry.
>
> Jup, you're right, a list_del() in there wouldn't harm. However, it
> currently wouldn't buy us anything either, and other functions we call
> from snd_usb_audio_disconnect() for list members don't kill their own
> list entry node themselves.

OK, thanks for the clarification.

julia

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: snd_usb_endpoint_free
  2014-06-25 10:13   ` snd_usb_endpoint_free Daniel Mack
  2014-06-25 10:16     ` snd_usb_endpoint_free Julia Lawall
@ 2014-06-25 12:33     ` Takashi Iwai
  1 sibling, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2014-06-25 12:33 UTC (permalink / raw)
  To: Daniel Mack; +Cc: Julia Lawall, alsa-devel

At Wed, 25 Jun 2014 12:13:25 +0200,
Daniel Mack wrote:
> 
> Hi Julia,
> 
> On 06/25/2014 08:50 AM, Julia Lawall wrote:
> > On Wed, 25 Jun 2014, Julia Lawall wrote:
> >> The function snd_usb_endpoint_free in sound/usb/endpoint.c is defined as 
> >> follows:
> >>
> >> void snd_usb_endpoint_free(struct list_head *head)
> >> {
> >>         struct snd_usb_endpoint *ep;
> >>
> >>         ep = list_entry(head, struct snd_usb_endpoint, list);
> >>         release_urbs(ep, 1);
> >>         kfree(ep);
> >> }
> >>
> >> I wonder if the final kfree should be list_del?  In practice, this 
> > 
> > Sorry, the question should be "I wonder if this function should also use 
> > list_del", since list_del doesn't subsume kfree.
> > 
> > julia
> > 
> >> function is only used from snd_usb_audio_disconnect in sound/usb/card.c 
> >> where the entire list is destroyed, but it seems like quite a generic 
> >> function that someone may someday want to use for just freeing one entry.
> 
> Jup, you're right, a list_del() in there wouldn't harm. However, it
> currently wouldn't buy us anything either, and other functions we call
> from snd_usb_audio_disconnect() for list members don't kill their own
> list entry node themselves.

Yes, it'd be better but the current code works as is, too.

In anyway, I'm going to add a fix later; we're working on a
disconnection race fix that involves with this function.


thanks,

Takashi

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-06-25 12:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-25  6:28 snd_usb_endpoint_free Julia Lawall
2014-06-25  6:50 ` snd_usb_endpoint_free Julia Lawall
2014-06-25 10:13   ` snd_usb_endpoint_free Daniel Mack
2014-06-25 10:16     ` snd_usb_endpoint_free Julia Lawall
2014-06-25 12:33     ` snd_usb_endpoint_free Takashi Iwai

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.