From: Artem Shimko <a.shimko.dev@gmail.com>
To: Mark Brown <broonie@kernel.org>, Philipp Zabel <p.zabel@pengutronix.de>
Cc: a.shimko.dev@gmail.com, linux-spi@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] spi: dw-mmio: add error handling for reset_control_deassert()
Date: Tue, 7 Oct 2025 13:11:33 +0300 [thread overview]
Message-ID: <20251007101134.1912895-1-a.shimko.dev@gmail.com> (raw)
Currently reset_control_deassert() is called without checking its
return value. This can lead to silent failures when reset deassertion
fails.
Add proper error handling to:
1. Check the return value of reset_control_deassert()
2. Return the error to the caller
3. Provide meaningful error message using dev_err_probe()
This ensures that reset-related failures are properly reported during
probe and helps with debugging reset issues.
Signed-off-by: Artem Shimko <a.shimko.dev@gmail.com>
---
This patch addresses an issue in the DesignWare SPI MMIO driver
where the return value of reset_control_deassert() was not being checked,
potentially leading to silent failures.
The problem occurs when reset deassertion fails - the driver would
continue probing without the device being properly reset, which could
result in unpredictable behavior or hardware malfunctions.
Patch adds proper error checking and propagation for the
reset_control_deassert() call, ensuring that probe fails gracefully
when reset operations cannot be completed successfully.
This change improves the robustness of the driver and provides better
debugging information when reset-related issues occur.
drivers/spi/spi-dw-mmio.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi-dw-mmio.c b/drivers/spi/spi-dw-mmio.c
index f0f576fac77a..7a5197586919 100644
--- a/drivers/spi/spi-dw-mmio.c
+++ b/drivers/spi/spi-dw-mmio.c
@@ -358,7 +358,9 @@ static int dw_spi_mmio_probe(struct platform_device *pdev)
if (IS_ERR(dwsmmio->rstc))
return PTR_ERR(dwsmmio->rstc);
- reset_control_deassert(dwsmmio->rstc);
+ ret = reset_control_deassert(dwsmmio->rstc);
+ if (ret)
+ return dev_err_probe(&pdev->dev, ret, "Failed to deassert resets\n");
dws->bus_num = pdev->id;
--
2.43.0
next reply other threads:[~2025-10-07 10:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-07 10:11 Artem Shimko [this message]
2025-10-07 17:15 ` 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=20251007101134.1912895-1-a.shimko.dev@gmail.com \
--to=a.shimko.dev@gmail.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=p.zabel@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
Powered by JetHome