]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ALSA: qc_audio_offload: Fix missing error code in prepare_qmi_response()
authorHarshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Mon, 23 Jun 2025 14:26:27 +0000 (07:26 -0700)
committerTakashi Iwai <tiwai@suse.de>
Tue, 24 Jun 2025 08:11:02 +0000 (10:11 +0200)
When snd_soc_usb_find_priv_data() fails, return failure instead of
success. While we are at it also use direct returns at first few error
paths where there is no additional cleanup needed.

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/Z_40qL4JnyjR4j0O@stanley.mountain/
Fixes: 326bbc348298 ("ALSA: usb-audio: qcom: Introduce QC USB SND offloading support")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Link: https://patch.msgid.link/20250623142639.2938056-1-harshit.m.mogalapalli@oracle.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/qcom/qc_audio_offload.c

index 5bc27c82e0af5c4b6bf7a249e5531720a20fe841..797afd4561bd0c1541fa4cd1cb4ace1812863a00 100644 (file)
@@ -1360,20 +1360,21 @@ static int prepare_qmi_response(struct snd_usb_substream *subs,
 
        if (!uadev[card_num].ctrl_intf) {
                dev_err(&subs->dev->dev, "audio ctrl intf info not cached\n");
-               ret = -ENODEV;
-               goto err;
+               return -ENODEV;
        }
 
        ret = uaudio_populate_uac_desc(subs, resp);
        if (ret < 0)
-               goto err;
+               return ret;
 
        resp->slot_id = subs->dev->slot_id;
        resp->slot_id_valid = 1;
 
        data = snd_soc_usb_find_priv_data(uaudio_qdev->auxdev->dev.parent);
-       if (!data)
-               goto err;
+       if (!data) {
+               dev_err(&subs->dev->dev, "No private data found\n");
+               return -ENODEV;
+       }
 
        uaudio_qdev->data = data;
 
@@ -1382,7 +1383,7 @@ static int prepare_qmi_response(struct snd_usb_substream *subs,
                                    &resp->xhci_mem_info.tr_data,
                                    &resp->std_as_data_ep_desc);
        if (ret < 0)
-               goto err;
+               return ret;
 
        resp->std_as_data_ep_desc_valid = 1;
 
@@ -1500,7 +1501,6 @@ drop_data_ep:
        xhci_sideband_remove_endpoint(uadev[card_num].sb,
                        usb_pipe_endpoint(subs->dev, subs->data_endpoint->pipe));
 
-err:
        return ret;
 }