Skip to contentSkip to conversation

ALSA: usb-audio: qcom: Introduce QC USB SND offloading support

bug report Dan Carpenter 1 participant 1 message Apr 15, 2025 Sound

lore
Share & tools
lore
#0 lore raw

Hello Wesley Cheng,

Commit 326bbc348298 ("ALSA: usb-audio: qcom: Introduce QC USB SND offloading support") from Apr 9, 2025 (linux-next), leads to the following Smatch static checker warning:

sound/usb/qcom/qc_audio_offload.c:773 qmi_stop_session()
error: uninitialized symbol 'ep'.

sound/usb/qcom/qc_audio_offload.c

    737 static void qmi_stop_session(void)
    738 {
    739         struct snd_usb_substream *subs;
    740         struct usb_host_endpoint *ep;
    741         struct snd_usb_audio *chip;
    742         struct intf_info *info;
    743         int pcm_card_num;
    744         int if_idx;
    745         int idx;
    746 
    747         mutex_lock(&qdev_mutex);
    748         /* find all active intf for set alt 0 and cleanup usb audio dev */
    749         for (idx = 0; idx < SNDRV_CARDS; idx++) {
    750                 if (!atomic_read(&uadev[idx].in_use))
    751                         continue;
    752 
    753                 chip = uadev[idx].chip;
    754                 for (if_idx = 0; if_idx < uadev[idx].num_intf; if_idx++) {
    755                         if (!uadev[idx].info || !uadev[idx].info[if_idx].in_use)
    756                                 continue;
    757                         info = &uadev[idx].info[if_idx];
    758                         pcm_card_num = info->pcm_card_num;
    759                         subs = find_substream(pcm_card_num, info->pcm_dev_num,
    760                                               info->direction);
    761                         if (!subs || !chip || atomic_read(&chip->shutdown)) {
    762                                 dev_err(&subs->dev->dev,
    763                                         "no sub for c#%u dev#%u dir%u\n",
    764                                         info->pcm_card_num,
    765                                         info->pcm_dev_num,
    766                                         info->direction);
    767                                 continue;
    768                         }
    769                         /* Release XHCI endpoints */
    770                         if (info->data_ep_pipe)
    771                                 ep = usb_pipe_endpoint(uadev[pcm_card_num].udev,
    772                                                        info->data_ep_pipe);
                                        ^^

ep not set on else path.

--> 773                         xhci_sideband_remove_endpoint(uadev[pcm_card_num].sb, ep);
                                                                                      ^^

uninitialized.

    774 
    775                         if (info->sync_ep_pipe)
    776                                 ep = usb_pipe_endpoint(uadev[pcm_card_num].udev,
    777                                                        info->sync_ep_pipe);
    778                         xhci_sideband_remove_endpoint(uadev[pcm_card_num].sb, ep);

same

    779 
    780                         disable_audio_stream(subs);
    781                 }
    782                 atomic_set(&uadev[idx].in_use, 0);
    783                 mutex_lock(&chip->mutex);
    784                 uaudio_dev_cleanup(&uadev[idx]);
    785                 mutex_unlock(&chip->mutex);
    786         }
    787         mutex_unlock(&qdev_mutex);
    788 }

regards,
dan carpenter