diff options
author | Guenter Roeck <guenter.roeck@ericsson.com> | 2011-08-26 11:12:38 -0400 |
---|---|---|
committer | Guenter Roeck <guenter.roeck@ericsson.com> | 2011-10-24 14:09:33 -0400 |
commit | 866cf12a0eab65f94e40608bdd21ca8dea4d0ac2 (patch) | |
tree | 4f419b461893f90d6e9a54f0852c3bd1a6254666 /drivers/hwmon/pmbus/lm25066.c | |
parent | 20fcfe172190704918969695a16cf621e2f4ce25 (diff) |
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 <khali@linux-fr.org>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/pmbus/lm25066.c')
-rw-r--r-- | drivers/hwmon/pmbus/lm25066.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/hwmon/pmbus/lm25066.c b/drivers/hwmon/pmbus/lm25066.c index ac254fba551b..2107f413e4fc 100644 --- a/drivers/hwmon/pmbus/lm25066.c +++ b/drivers/hwmon/pmbus/lm25066.c | |||
@@ -309,11 +309,10 @@ static int lm25066_remove(struct i2c_client *client) | |||
309 | { | 309 | { |
310 | const struct pmbus_driver_info *info = pmbus_get_driver_info(client); | 310 | const struct pmbus_driver_info *info = pmbus_get_driver_info(client); |
311 | const struct lm25066_data *data = to_lm25066_data(info); | 311 | const struct lm25066_data *data = to_lm25066_data(info); |
312 | int ret; | ||
313 | 312 | ||
314 | ret = pmbus_do_remove(client); | 313 | pmbus_do_remove(client); |
315 | kfree(data); | 314 | kfree(data); |
316 | return ret; | 315 | return 0; |
317 | } | 316 | } |
318 | 317 | ||
319 | static const struct i2c_device_id lm25066_id[] = { | 318 | static const struct i2c_device_id lm25066_id[] = { |