All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Wesley Cheng <quic_wcheng@quicinc.com>
Cc: linux-sound@vger.kernel.org
Subject: [bug report] ALSA: usb-audio: qcom: Introduce QC USB SND offloading support
Date: Tue, 15 Apr 2025 13:46:05 +0300	[thread overview]
Message-ID: <Z_447cXhvGLSVg_7@stanley.mountain> (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:762 qmi_stop_session()
	error: we previously assumed 'subs' could be null (see line 761)

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)) {
                                     ^^^^
Check for NULL

--> 762                                 dev_err(&subs->dev->dev,
                                                ^^^^^^^^^^^^^^^
Unchecked derefrence

    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;

regards,
dan carpenter

             reply	other threads:[~2025-04-15 10:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-15 10:46 Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-04-15 10:47 [bug report] ALSA: usb-audio: qcom: Introduce QC USB SND offloading support Dan Carpenter
2025-04-15 10:46 Dan Carpenter
2025-04-15 10:45 Dan Carpenter
2025-04-15 10:27 Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z_447cXhvGLSVg_7@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=quic_wcheng@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.