Linux Sound subsystem development
 help / color / mirror / Atom feed
* [bug report] ASoC: SOF: amd: Use AMD_NODE
@ 2026-05-11  7:24 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2026-05-11  7:24 UTC (permalink / raw)
  To: Mario Limonciello; +Cc: linux-sound

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-05-11  7:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-11  7:24 [bug report] ASoC: SOF: amd: Use AMD_NODE Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox