From b52f798c52b51ea6598e509403b50423338aff00 Mon Sep 17 00:00:00 2001 From: Pratham Pratap Date: Wed, 24 Jun 2020 15:47:36 +0530 Subject: [PATCH] sound: usb: Fix error handling path Commit 2733ec307cd5 ("sound: usb: Clear in_use if wait_event fails while disconnect") added ENODEV check with EINVAL in the error path if chip is removed while handling uaudio stream request. Instead, both the error codes should be checked exclusively in the return path to avoid NULL pointer access. Change-Id: Iebf12b6f13fc6a22c679ed3482759c9173004bb8 Signed-off-by: Pratham Pratap --- sound/usb/usb_audio_qmi_svc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/usb/usb_audio_qmi_svc.c b/sound/usb/usb_audio_qmi_svc.c index 6297d720a498..5a65a692f424 100644 --- a/sound/usb/usb_audio_qmi_svc.c +++ b/sound/usb/usb_audio_qmi_svc.c @@ -1159,7 +1159,7 @@ static void handle_uaudio_stream_req(struct qmi_handle *handle, mutex_unlock(&chip->dev_lock); response: - if (!req_msg->enable && (ret != -EINVAL || ret != -ENODEV)) { + if (!req_msg->enable && ret != -EINVAL && ret != -ENODEV) { mutex_lock(&chip->dev_lock); if (info_idx >= 0) { info = &uadev[pcm_card_num].info[info_idx];