mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ștefan Ghețu" <stefanghetu9@gmail.com>
To: lgirdwood@gmail.com, peter.ujfalusi@linux.intel.com,
	yung-chuan.liao@linux.intel.com, daniel.baluta@nxp.com,
	broonie@kernel.org
Cc: kai.vehmanen@linux.intel.com, pierre-louis.bossart@linux.dev,
	perex@perex.cz, tiwai@suse.com,
	sound-open-firmware@alsa-project.org,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Ștefan Ghețu" <stefanghetu9@gmail.com>
Subject: [PATCH] ASoC: SOF: imx8: check imx_sc_pm_cpu_start() return value
Date: Wed,  2 Sep 2026 20:55:17 +0300	[thread overview]
Message-ID: <20260902175517.209406-1-stefanghetu9@gmail.com> (raw)

imx8_run(), imx8x_run() and imx8_shutdown() check the return value of
every imx_sc_misc_set_control() call but ignore the one from
imx_sc_pm_cpu_start(), which propagates errors from imx_scu_call_rpc()
and can fail with -ETIMEDOUT, -EINVAL or -EPERM.

Reporting success after a failed start leaves the caller loading
firmware onto a core that is not running, and a failed shutdown is
similarly hidden from imx_chip_core_shutdown() callers, which do act on
the return value.

Propagate the error, matching imx95_core_shutdown() in imx9.c.

Signed-off-by: Ștefan Ghețu <stefanghetu9@gmail.com>
---
 sound/soc/sof/imx/imx8.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/sound/soc/sof/imx/imx8.c b/sound/soc/sof/imx/imx8.c
index c2b4d379a3a3a..0820724dbb349 100644
--- a/sound/soc/sof/imx/imx8.c
+++ b/sound/soc/sof/imx/imx8.c
@@ -41,13 +41,18 @@ struct imx8m_chip_data {
 
 static int imx8_shutdown(struct snd_sof_dev *sdev)
 {
+	int ret;
 	/*
 	 * Force the DSP to stall. After the firmware image is loaded,
 	 * the stall will be removed during run() by a matching
 	 * imx_sc_pm_cpu_start() call.
 	 */
-	imx_sc_pm_cpu_start(get_chip_pdata(sdev), IMX_SC_R_DSP, false,
-			    RESET_VECTOR_VADDR);
+	ret = imx_sc_pm_cpu_start(get_chip_pdata(sdev), IMX_SC_R_DSP, false,
+				  RESET_VECTOR_VADDR);
+	if (ret < 0) {
+		dev_err(sdev->dev, "Error stalling DSP core %d\n", ret);
+		return ret;
+	}
 
 	return 0;
 }
@@ -88,8 +93,12 @@ static int imx8x_run(struct snd_sof_dev *sdev)
 		return ret;
 	}
 
-	imx_sc_pm_cpu_start(get_chip_pdata(sdev), IMX_SC_R_DSP, true,
-			    RESET_VECTOR_VADDR);
+	ret = imx_sc_pm_cpu_start(get_chip_pdata(sdev), IMX_SC_R_DSP, true,
+				  RESET_VECTOR_VADDR);
+	if (ret < 0) {
+		dev_err(sdev->dev, "Error starting DSP %d\n", ret);
+		return ret;
+	}
 
 	return 0;
 }
@@ -105,8 +114,12 @@ static int imx8_run(struct snd_sof_dev *sdev)
 		return ret;
 	}
 
-	imx_sc_pm_cpu_start(get_chip_pdata(sdev), IMX_SC_R_DSP, true,
-			    RESET_VECTOR_VADDR);
+	ret = imx_sc_pm_cpu_start(get_chip_pdata(sdev), IMX_SC_R_DSP, true,
+				  RESET_VECTOR_VADDR);
+	if (ret < 0) {
+		dev_err(sdev->dev, "Error starting DSP %d\n", ret);
+		return ret;
+	}
 
 	return 0;
 }
-- 
2.53.0


                 reply	other threads:[~2026-09-02 17:55 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=20260902175517.209406-1-stefanghetu9@gmail.com \
    --to=stefanghetu9@gmail.com \
    --cc=broonie@kernel.org \
    --cc=daniel.baluta@nxp.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.dev \
    --cc=sound-open-firmware@alsa-project.org \
    --cc=tiwai@suse.com \
    --cc=yung-chuan.liao@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®