Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: accel: mma7660: Warn about failure to put device in stand-by in .remove()

Whan an i2c 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 <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20211025195007.84541-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Uwe Kleine-König and committed by
Jonathan Cameron
e12653eb 8eebe628

+7 -1
+7 -1
drivers/iio/accel/mma7660.c
··· 210 210 static int mma7660_remove(struct i2c_client *client) 211 211 { 212 212 struct iio_dev *indio_dev = i2c_get_clientdata(client); 213 + int ret; 213 214 214 215 iio_device_unregister(indio_dev); 215 216 216 - return mma7660_set_mode(iio_priv(indio_dev), MMA7660_MODE_STANDBY); 217 + ret = mma7660_set_mode(iio_priv(indio_dev), MMA7660_MODE_STANDBY); 218 + if (ret) 219 + dev_warn(&client->dev, "Failed to put device in stand-by mode (%pe), ignoring\n", 220 + ERR_PTR(ret)); 221 + 222 + return 0; 217 223 } 218 224 219 225 #ifdef CONFIG_PM_SLEEP