[PATCH] ALSA: usb-audio: fix usb camero disconnect issue

From: aichao
Date: Thu Nov 03 2022 - 21:33:02 EST


When current rate is different from the runtime rate,
snd_usb_endpoint stop and close endpoint to resetting rate.
if snd_usb_endpoint close the endpoint, sometimes usb will
disconnect the device.

Signed-off-by: aichao <aichao@xxxxxxxxxx>
---
sound/usb/pcm.c | 5 -----
1 file changed, 5 deletions(-)

diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index 5dc9266180e3..2ae4a55cbaa8 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -517,7 +517,6 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
if (snd_usb_endpoint_compatible(chip, subs->data_endpoint,
fmt, hw_params))
goto unlock;
- close_endpoints(chip, subs);
}

subs->data_endpoint = snd_usb_endpoint_open(chip, fmt, hw_params, false);
@@ -546,9 +545,6 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
ret = configure_endpoints(chip, subs);

unlock:
- if (ret < 0)
- close_endpoints(chip, subs);
-
snd_usb_unlock_shutdown(chip);
stop_pipeline:
if (ret < 0)
@@ -574,7 +570,6 @@ static int snd_usb_hw_free(struct snd_pcm_substream *substream)
if (!snd_usb_lock_shutdown(chip)) {
if (stop_endpoints(subs))
sync_pending_stops(subs);
- close_endpoints(chip, subs);
snd_usb_unlock_shutdown(chip);
}

--
2.25.1