[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201119152059.2631650-3-u.kleine-koenig@pengutronix.de>
Date: Thu, 19 Nov 2020 16:20:59 +0100
From: Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>
To: Mark Brown <broonie@...nel.org>
Cc: linux-spi@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel@...gutronix.de,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: [PATCH 3/3] spi: Warn when a driver's remove callback returns an error
The driver core ignores the return value of struct device_driver::remove
(because in general there is nothing that can be done about that). So
add a warning when an spi driver returns an error.
This simplifies the quest to make struct device_driver::remove return void.
A consequent change would be to make struct spi_driver::remove return void,
but I'm keeping this quest for later (or someone else).
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
---
drivers/spi/spi.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index e8c0a000ee19..6b7c19bf7715 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -408,13 +408,20 @@ static int spi_probe(struct device *dev)
static int spi_remove(struct device *dev)
{
const struct spi_driver *sdrv = to_spi_driver(dev->driver);
- int ret = 0;
- if (sdrv->remove)
+ if (sdrv->remove) {
+ int ret;
+
ret = sdrv->remove(to_spi_device(dev));
+ if (ret)
+ dev_warn(dev,
+ "Failed to unbind driver (%pe), ignoring\n",
+ ERR_PTR(ret));
+ }
+
dev_pm_domain_detach(dev, true);
- return ret;
+ return 0;
}
static void spi_shutdown(struct device *dev)
--
2.28.0
Powered by blists - more mailing lists