diff mbox series

[v2,04/20] hwmon: max31722: Warn about failure to put device in stand-by in .remove()

Message ID 20211012153945.2651412-5-u.kleine-koenig@pengutronix.de (mailing list archive)
State Accepted
Headers show
Series Make some spi device drivers return zero in .remove() | expand

Commit Message

Uwe Kleine-König Oct. 12, 2021, 3:39 p.m. UTC
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>
---
 drivers/hwmon/max31722.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Guenter Roeck Oct. 12, 2021, 3:51 p.m. UTC | #1
On Tue, Oct 12, 2021 at 05:39:29PM +0200, Uwe Kleine-König wrote:
> 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>

Applied to hwmon-next.

Thanks,
Guenter

> ---
>  drivers/hwmon/max31722.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/max31722.c b/drivers/hwmon/max31722.c
> index 613338cbcb17..4cf4fe6809a3 100644
> --- a/drivers/hwmon/max31722.c
> +++ b/drivers/hwmon/max31722.c
> @@ -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)
diff mbox series

Patch

diff --git a/drivers/hwmon/max31722.c b/drivers/hwmon/max31722.c
index 613338cbcb17..4cf4fe6809a3 100644
--- a/drivers/hwmon/max31722.c
+++ b/drivers/hwmon/max31722.c
@@ -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)