linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Error checking for spi_setup during probe function added to rtc-m41t94 driver
@ 2023-03-03 21:45 Nur Hussein
  0 siblings, 0 replies; only message in thread
From: Nur Hussein @ 2023-03-03 21:45 UTC (permalink / raw)
  To: a.zummo, alexandre.belloni, linux-rtc, linux-kernel; +Cc: Nur Hussein

The m41t94_probe() function calls spi_setup() but does not check for an
error upon return. I have added this check, and returns the error and
sets the error message via dev_error to "spi_setup failed".

Signed-off-by: Nur Hussein <hussein@unixcat.org>
---
 drivers/rtc/rtc-m41t94.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-m41t94.c b/drivers/rtc/rtc-m41t94.c
index 6803b0273302..4bdee2336228 100644
--- a/drivers/rtc/rtc-m41t94.c
+++ b/drivers/rtc/rtc-m41t94.c
@@ -112,7 +112,12 @@ static int m41t94_probe(struct spi_device *spi)
 	int res;
 
 	spi->bits_per_word = 8;
-	spi_setup(spi);
+
+	res = spi_setup(spi);
+	if (res < 0) {
+		dev_err(&spi->dev, "spi setup failed.\n");
+		return res;
+	}
 
 	res = spi_w8r8(spi, M41T94_REG_SECONDS);
 	if (res < 0) {
-- 
2.34.1


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

only message in thread, other threads:[~2023-03-03 21:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-03 21:45 [PATCH] Error checking for spi_setup during probe function added to rtc-m41t94 driver Nur Hussein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).