Thread (38 messages) 38 messages, 11 authors, 2021-10-21
STALE1682d

[PATCH v2 16/20] mtd: sst25l: Warn about failure to unregister mtd device

From: Uwe Kleine-König <hidden>
Date: 2021-10-12 15:40:10
Subsystem: memory technology devices (mtd), the rest · Maintainers: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra, Linus Torvalds

When an spi driver's remove function returns a non-zero error code
nothing happens apart from emitting a generic error message. Make this
error message more device specific and return zero instead.

Signed-off-by: Uwe Kleine-König <redacted>
---
 drivers/mtd/devices/sst25l.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/devices/sst25l.c b/drivers/mtd/devices/sst25l.c
index b81c3f0b85f9..04062a1f54c1 100644
--- a/drivers/mtd/devices/sst25l.c
+++ b/drivers/mtd/devices/sst25l.c
@@ -401,8 +401,14 @@ static int sst25l_probe(struct spi_device *spi)
 static int sst25l_remove(struct spi_device *spi)
 {
 	struct sst25l_flash *flash = spi_get_drvdata(spi);
+	int ret;
+
+	ret = mtd_device_unregister(&flash->mtd);
+	if (ret)
+		dev_warn(&spi->dev, "Failed to unregister mtd device (%pe)\n",
+			 ERR_PTR(ret));
 
-	return mtd_device_unregister(&flash->mtd);
+	return 0;
 }
 
 static struct spi_driver sst25l_driver = {
-- 
2.30.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help