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@pengutronix.de>
Link: https://lore.kernel.org/r/20201119161604.2633521-3-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Uwe Kleine-König 2020-11-19 17:16:04 +01:00 коммит произвёл Mark Brown
Родитель 9db34ee64c
Коммит 7795d47575
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 24D68B725D5487D0
1 изменённых файлов: 10 добавлений и 3 удалений

Просмотреть файл

@ -408,13 +408,20 @@ static int spi_probe(struct device *dev)
static int spi_remove(struct device *dev) static int spi_remove(struct device *dev)
{ {
const struct spi_driver *sdrv = to_spi_driver(dev->driver); 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)); 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); dev_pm_domain_detach(dev, true);
return ret; return 0;
} }
static void spi_shutdown(struct device *dev) static void spi_shutdown(struct device *dev)