From 866cf12a0eab65f94e40608bdd21ca8dea4d0ac2 Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Fri, 26 Aug 2011 08:12:38 -0700 Subject: hwmon: (pmbus) Don't return errors from driver remove functions Driver remove functions have an error return value, but rarely return an error in practice. If a driver does return an error from its remove function, the driver won't be unloaded and is expected to stay alive. pmbus_do_remove() is defined as returning an int, but always returns 0 (no error). Calling code passes that return value on to high level driver remove functions, but does not evaluate it and removes driver data even if pmbus_do_remove() returned an error (which it in practice never does). Even if this code could never cause a real problem, it is nevertheless conceptually wrong. To reduce confusion and simplify the code, change pmbus_do_remove() to be a void function, and have PMBus client drivers always return zero in their driver remove functions. Reported-by: Jean Delvare Signed-off-by: Guenter Roeck Acked-by: Jean Delvare --- drivers/hwmon/pmbus/pmbus_core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/hwmon/pmbus/pmbus_core.c') diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index 397fc59b5682..36f287076ee2 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -1764,7 +1764,7 @@ out_data: } EXPORT_SYMBOL_GPL(pmbus_do_probe); -int pmbus_do_remove(struct i2c_client *client) +void pmbus_do_remove(struct i2c_client *client) { struct pmbus_data *data = i2c_get_clientdata(client); hwmon_device_unregister(data->hwmon_dev); @@ -1774,7 +1774,6 @@ int pmbus_do_remove(struct i2c_client *client) kfree(data->booleans); kfree(data->sensors); kfree(data); - return 0; } EXPORT_SYMBOL_GPL(pmbus_do_remove); -- cgit v1.2.3