hwmon: (max31722) Warn about failure to put device in stand-by in .remove()

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.

Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20211012153945.2651412-5-u.kleine-koenig@pengutronix.de
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
Uwe Kleine-König 2021-10-12 17:39:29 +02:00 committed by Guenter Roeck
parent 2c59a32d12
commit efb389b8c3

View File

@ -103,10 +103,16 @@ static int max31722_probe(struct spi_device *spi)
static int max31722_remove(struct spi_device *spi)
{
struct max31722_data *data = spi_get_drvdata(spi);
int ret;
hwmon_device_unregister(data->hwmon_dev);
return max31722_set_mode(data, MAX31722_MODE_STANDBY);
ret = max31722_set_mode(data, MAX31722_MODE_STANDBY);
if (ret)
/* There is nothing we can do about this ... */
dev_warn(&spi->dev, "Failed to put device in stand-by mode\n");
return 0;
}
static int __maybe_unused max31722_suspend(struct device *dev)