summaryrefslogtreecommitdiffstats
path: root/sound/usb/endpoint.c
diff options
context:
space:
mode:
authorChris Down <chris@chrisdown.name>2023-04-21 15:38:41 +0100
committerTakashi Iwai <tiwai@suse.de>2023-04-21 17:07:28 +0200
commit2db2be5607c4508c37705d604437b43a99b4791f (patch)
tree0964ccfd740f75da9cd0c6091c569611df31cbfe /sound/usb/endpoint.c
parent4d421eebe1465d94b95867dd025385dc3d661f9b (diff)
downloadlinux-2db2be5607c4508c37705d604437b43a99b4791f.tar.gz
linux-2db2be5607c4508c37705d604437b43a99b4791f.tar.bz2
linux-2db2be5607c4508c37705d604437b43a99b4791f.zip
ALSA: usb-audio: Rate limit usb_set_interface error reporting
When an error occurs during USB disconnection sometimes things can go wrong as endpoint_set_interface may end up being called repeatedly. For example: % dmesg --notime | grep 'usb 3-7.1.4' | sort | uniq -c | head -2 3069 usb 3-7.1.4: 1:1: usb_set_interface failed (-19) 908 usb 3-7.1.4: 1:1: usb_set_interface failed (-71) In my case, there sometimes are hundreds of these usb_set_interface failure messages a second when I disconnect the hub that has my USB audio device. These messages can take a huge amount of the kmsg ringbuffer and don't provide any extra information over the previous ones, so ratelimit them. Signed-off-by: Chris Down <chris@chrisdown.name> Link: https://lore.kernel.org/r/ZEKf8UYBYa1h4JWR@chrisdown.name Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/endpoint.c')
-rw-r--r--sound/usb/endpoint.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index 25563a5093c5..a385e85c4650 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -916,8 +916,9 @@ static int endpoint_set_interface(struct snd_usb_audio *chip,
ep->iface, altset, ep->ep_num);
err = usb_set_interface(chip->dev, ep->iface, altset);
if (err < 0) {
- usb_audio_err(chip, "%d:%d: usb_set_interface failed (%d)\n",
- ep->iface, altset, err);
+ usb_audio_err_ratelimited(
+ chip, "%d:%d: usb_set_interface failed (%d)\n",
+ ep->iface, altset, err);
return err;
}