Commit 71637c62 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Wolfram Sang

i2c: Warn when device removing fails

The driver core ignores the return value of struct bus_type::remove. So
warn if there is an error that went unnoticed before and return 0
unconditionally in i2c_device_remove().

This prepares changing struct bus_type::remove to return void.
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
[wsa: added a comment and removed unneeded initializtion]
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
parent bfbccd70
...@@ -551,15 +551,19 @@ static int i2c_device_remove(struct device *dev) ...@@ -551,15 +551,19 @@ static int i2c_device_remove(struct device *dev)
{ {
struct i2c_client *client = i2c_verify_client(dev); struct i2c_client *client = i2c_verify_client(dev);
struct i2c_driver *driver; struct i2c_driver *driver;
int status = 0;
if (!client || !dev->driver) if (!client || !dev->driver)
return 0; return 0;
driver = to_i2c_driver(dev->driver); driver = to_i2c_driver(dev->driver);
if (driver->remove) { if (driver->remove) {
int status;
dev_dbg(dev, "remove\n"); dev_dbg(dev, "remove\n");
status = driver->remove(client); status = driver->remove(client);
if (status)
dev_warn(dev, "remove failed (%pe), will be ignored\n", ERR_PTR(status));
} }
dev_pm_domain_detach(&client->dev, true); dev_pm_domain_detach(&client->dev, true);
...@@ -571,7 +575,8 @@ static int i2c_device_remove(struct device *dev) ...@@ -571,7 +575,8 @@ static int i2c_device_remove(struct device *dev)
if (client->flags & I2C_CLIENT_HOST_NOTIFY) if (client->flags & I2C_CLIENT_HOST_NOTIFY)
pm_runtime_put(&client->adapter->dev); pm_runtime_put(&client->adapter->dev);
return status; /* return always 0 because there is WIP to make remove-functions void */
return 0;
} }
static void i2c_device_shutdown(struct device *dev) static void i2c_device_shutdown(struct device *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment