All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Mario Limonciello <mario.limonciello@amd.com>
Cc: linux-sound@vger.kernel.org
Subject: [bug report] ASoC: SOF: amd: Use AMD_NODE
Date: Mon, 11 May 2026 10:24:59 +0300	[thread overview]
Message-ID: <agGES8vWrLOrBu28@stanley.mountain> (raw)

Hello Mario Limonciello,

Commit f120cf33d232 ("ASoC: SOF: amd: Use AMD_NODE") from Feb 17,
2025 (linux-next), leads to the following Smatch static checker
warning:

	sound/soc/sof/amd/acp.c:232 psp_send_cmd()
	warn: kernel error codes cast to unsigned 'data'

sound/soc/sof/amd/acp.c
    222 static int psp_send_cmd(struct acp_dev_data *adata, int cmd)
    223 {
    224         struct snd_sof_dev *sdev = adata->dev;
    225         int ret;
    226         u32 data;
    227 
    228         if (!cmd)
    229                 return -EINVAL;
    230 
    231         /* Get a non-zero Doorbell value from PSP */
--> 232         ret = read_poll_timeout(smn_read_register, data, data > 0, MBOX_DELAY_US,
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The smn_read_register() returns negative error codes or positive
values on success.  We're storing the return in data and testing data > 0
to see if it succeeds.  But since data is unsigned then negative error
codes are treated as success.

    233                                 ACP_PSP_TIMEOUT_US, false, MP0_C2PMSG_73_REG);
    234 
    235         if (ret) {
    236                 dev_err(sdev->dev, "Failed to get Doorbell from MBOX %x\n", MP0_C2PMSG_73_REG);
    237                 return ret;
    238         }
    239 
    240         /* Check if PSP is ready for new command */
    241         ret = psp_mbox_ready(adata, 0);
    242         if (ret)
    243                 return ret;
    244 

This email is a free service from the Smatch-CI project [smatch.sf.net].

regards,
dan carpenter

                 reply	other threads:[~2026-05-11  7:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=agGES8vWrLOrBu28@stanley.mountain \
    --to=error27@gmail.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=mario.limonciello@amd.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.