diff options
author | Laszlo Papp <lpapp@kde.org> | 2013-12-17 07:49:51 -0500 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2014-01-21 03:28:10 -0500 |
commit | c1ec8fc308bb8171c76b5bed7f4028b6290e53f9 (patch) | |
tree | cae119ca4ac650a4e0ca1e3822115a4c87b5ac77 | |
parent | db9ef449aaa550389008c2020fba02e4440ce24b (diff) |
mfd: max8997: Enforce mfd_add_devices() return value check
The original author provided a random return value check which is
redundant and seemingly floating. This patch not only relocates
the check so it is more clearly associated with the invokation of
mfd_add_devices(), but provides a store for the error value. We
also print a meaningful message on error before returning.
Signed-off-by: Laszlo Papp <lpapp@kde.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
-rw-r--r-- | drivers/mfd/max8997.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/mfd/max8997.c b/drivers/mfd/max8997.c index 1b80e51c2e73..10141698ff94 100644 --- a/drivers/mfd/max8997.c +++ b/drivers/mfd/max8997.c | |||
@@ -228,18 +228,19 @@ static int max8997_i2c_probe(struct i2c_client *i2c, | |||
228 | 228 | ||
229 | max8997_irq_init(max8997); | 229 | max8997_irq_init(max8997); |
230 | 230 | ||
231 | mfd_add_devices(max8997->dev, -1, max8997_devs, | 231 | ret = mfd_add_devices(max8997->dev, -1, max8997_devs, |
232 | ARRAY_SIZE(max8997_devs), | 232 | ARRAY_SIZE(max8997_devs), |
233 | NULL, 0, NULL); | 233 | NULL, 0, NULL); |
234 | if (ret < 0) { | ||
235 | dev_err(max8997->dev, "failed to add MFD devices %d\n", ret); | ||
236 | goto err_mfd; | ||
237 | } | ||
234 | 238 | ||
235 | /* | 239 | /* |
236 | * TODO: enable others (flash, muic, rtc, battery, ...) and | 240 | * TODO: enable others (flash, muic, rtc, battery, ...) and |
237 | * check the return value | 241 | * check the return value |
238 | */ | 242 | */ |
239 | 243 | ||
240 | if (ret < 0) | ||
241 | goto err_mfd; | ||
242 | |||
243 | /* MAX8997 has a power button input. */ | 244 | /* MAX8997 has a power button input. */ |
244 | device_init_wakeup(max8997->dev, pdata->wakeup); | 245 | device_init_wakeup(max8997->dev, pdata->wakeup); |
245 | 246 | ||