All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: usb-audio: Fix quirks code is not called
@ 2016-07-17 16:16 Kazuki Oikawa
  2016-07-18  5:35 ` Takashi Sakamoto
  2016-07-18 10:35 ` Takashi Iwai
  0 siblings, 2 replies; 3+ messages in thread
From: Kazuki Oikawa @ 2016-07-17 16:16 UTC (permalink / raw)
  To: alsa-devel; +Cc: Kazuki Oikawa

snd_usb_{set_interface,ctl_msg}_quirk checks chip->usb_id to need
calling a quirks code. But existed code path that not calling
dev_set_drvdata in usb_audio_probe.

Signed-off-by: Kazuki Oikawa <k@oikw.org>
Fixes: 79289e24194a ("ALSA: usb-audio: Refer to chip->usb_id for quirks and MIDI creation")
---
 sound/usb/card.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/usb/card.c b/sound/usb/card.c
index 3fc63583a537..2d493501b7f6 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -552,7 +552,6 @@ static int usb_audio_probe(struct usb_interface *intf,
 				goto __error;
 			}
 			chip = usb_chip[i];
-			dev_set_drvdata(&dev->dev, chip);
 			atomic_inc(&chip->active); /* avoid autopm */
 			break;
 		}
@@ -578,6 +577,7 @@ static int usb_audio_probe(struct usb_interface *intf,
 			goto __error;
 		}
 	}
+	dev_set_drvdata(&dev->dev, chip);
 
 	/*
 	 * For devices with more than one control interface, we assume the
-- 
2.9.2

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

* Re: [PATCH] ALSA: usb-audio: Fix quirks code is not called
  2016-07-17 16:16 [PATCH] ALSA: usb-audio: Fix quirks code is not called Kazuki Oikawa
@ 2016-07-18  5:35 ` Takashi Sakamoto
  2016-07-18 10:35 ` Takashi Iwai
  1 sibling, 0 replies; 3+ messages in thread
From: Takashi Sakamoto @ 2016-07-18  5:35 UTC (permalink / raw)
  To: Kazuki Oikawa, Takashi Iwai; +Cc: alsa-devel, nekomatu+linux

Hi,

On Jul 18 2016 01:16, Kazuki Oikawa wrote:
> snd_usb_{set_interface,ctl_msg}_quirk checks chip->usb_id to need
> calling a quirks code. But existed code path that not calling
> dev_set_drvdata in usb_audio_probe.
> 
> Signed-off-by: Kazuki Oikawa <k@oikw.org>
> Fixes: 79289e24194a ("ALSA: usb-audio: Refer to chip->usb_id for quirks and MIDI creation")
> ---
>  sound/usb/card.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/usb/card.c b/sound/usb/card.c
> index 3fc63583a537..2d493501b7f6 100644
> --- a/sound/usb/card.c
> +++ b/sound/usb/card.c
> @@ -552,7 +552,6 @@ static int usb_audio_probe(struct usb_interface *intf,
>  				goto __error;
>  			}
>  			chip = usb_chip[i];
> -			dev_set_drvdata(&dev->dev, chip);
>  			atomic_inc(&chip->active); /* avoid autopm */
>  			break;
>  		}
> @@ -578,6 +577,7 @@ static int usb_audio_probe(struct usb_interface *intf,
>  			goto __error;
>  		}
>  	}
> +	dev_set_drvdata(&dev->dev, chip);
>  
>  	/*
>  	 * For devices with more than one control interface, we assume the

Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Tested-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

Let me describe supplemental comments.

This bug affects all of USB devices which take USB subsystem to call an
implementation of struct usb_driver.probe() in snd-usb-audio
(=usb_audio_probe()) just one time. In this case, dev_set_drvdata() is
not called at first call of usb_audio_probe(), then dev_get_drvdata()
returns NULL.

As a result, some quirks are not handled. snd_usb_set_interface_quirk()
and snd_usb_set_interface_quirk() returns immediately without enough
operations. This brings regressions to some models.

As long as I asked to Mr.Oikawa in this morning, below models are affected.
 * Playback Design
 * TEAC
 * Marantz
 * Denon
 * Zoom R16/24

I tested with EMU 0404 USB. This model has no quirks related to above
functions, but it brings just one call of usb_audio_probe(). Then,
without this patch, I can see dev_get_drvdata() always returns NULL
whole lifetime of usb device instance.
(But even with this patch, in a call of snd_usb_audio_free(),
dev_get_drvdata() returns NULL before a call of dev_set_devdata(NULL),
against my expectation. I don't know why...)

This patch should go for 4.8 merge window.


Regards

Takashi Sakamoto

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

* Re: [PATCH] ALSA: usb-audio: Fix quirks code is not called
  2016-07-17 16:16 [PATCH] ALSA: usb-audio: Fix quirks code is not called Kazuki Oikawa
  2016-07-18  5:35 ` Takashi Sakamoto
@ 2016-07-18 10:35 ` Takashi Iwai
  1 sibling, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2016-07-18 10:35 UTC (permalink / raw)
  To: Kazuki Oikawa; +Cc: alsa-devel

On Sun, 17 Jul 2016 18:16:15 +0200,
Kazuki Oikawa wrote:
> 
> snd_usb_{set_interface,ctl_msg}_quirk checks chip->usb_id to need
> calling a quirks code. But existed code path that not calling
> dev_set_drvdata in usb_audio_probe.
> 
> Signed-off-by: Kazuki Oikawa <k@oikw.org>
> Fixes: 79289e24194a ("ALSA: usb-audio: Refer to chip->usb_id for quirks and MIDI creation")

Applied with Cc to stable now.  Thanks.


Takashi

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

end of thread, other threads:[~2016-07-18 10:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-17 16:16 [PATCH] ALSA: usb-audio: Fix quirks code is not called Kazuki Oikawa
2016-07-18  5:35 ` Takashi Sakamoto
2016-07-18 10:35 ` 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.