public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: John Madieu <john.madieu@gmail.com>
To: broonie@kernel.org, Frank.Li@nxp.com, s.hauer@pengutronix.de
Cc: kernel@pengutronix.de, festevam@gmail.com, carlos.song@nxp.com,
	linux-spi@vger.kernel.org, imx@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, John Madieu <john.madieu@gmail.com>
Subject: [PATCH 3/3] spi: imx: Propagate prepare_transfer() error from spi_imx_setupxfer()
Date: Fri,  1 May 2026 13:59:51 +0000	[thread overview]
Message-ID: <20260501135951.2416527-4-john.madieu@gmail.com> (raw)
In-Reply-To: <20260501135951.2416527-1-john.madieu@gmail.com>

spi_imx_setupxfer() calls the per-variant prepare_transfer()
callback and returns 0 unconditionally:

	spi_imx->devtype_data->prepare_transfer(spi_imx, spi, t);

	return 0;

mx51_ecspi_prepare_transfer() can return -EINVAL when the requested
word_delay does not fit in MX51_ECSPI_PERIOD_MASK. The error is
detected after a partial set of register writes (CTRL: BL, clkdiv,
SMC), so the controller is left in a partially-configured state and
the transfer is then submitted as if setup succeeded.

Propagate the return value. The other variants' prepare_transfer
callbacks all return 0, so this is a no-op for them.

Signed-off-by: John Madieu <john.madieu@gmail.com>
---
 drivers/spi/spi-imx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index 4e3dbd01d619..480d1e8b281f 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -1382,9 +1382,7 @@ static int spi_imx_setupxfer(struct spi_device *spi,
 		spi_imx->target_burst = t->len;
 	}
 
-	spi_imx->devtype_data->prepare_transfer(spi_imx, spi, t);
-
-	return 0;
+	return spi_imx->devtype_data->prepare_transfer(spi_imx, spi, t);
 }
 
 static void spi_imx_sdma_exit(struct spi_imx_data *spi_imx)
-- 
2.25.1



  parent reply	other threads:[~2026-05-01 14:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-01 13:59 [PATCH 0/3] spi: imx: Three fixes for the i.MX SPI driver John Madieu
2026-05-01 13:59 ` [PATCH 1/3] spi: imx: Fix precedence bug in spi_imx_dma_max_wml_find() John Madieu
2026-05-02  4:46   ` Frank Li
2026-05-01 13:59 ` [PATCH 2/3] spi: imx: Fix UAF on package-1 prepare failure in spi_imx_dma_data_prepare() John Madieu
2026-05-02  4:49   ` Frank Li
2026-05-01 13:59 ` John Madieu [this message]
2026-05-02  4:51   ` [PATCH 3/3] spi: imx: Propagate prepare_transfer() error from spi_imx_setupxfer() Frank Li
2026-05-04 13:22 ` [PATCH 0/3] spi: imx: Three fixes for the i.MX SPI driver Mark Brown

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=20260501135951.2416527-4-john.madieu@gmail.com \
    --to=john.madieu@gmail.com \
    --cc=Frank.Li@nxp.com \
    --cc=broonie@kernel.org \
    --cc=carlos.song@nxp.com \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    /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