summaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorLaszlo Papp <lpapp@kde.org>2013-12-17 12:49:51 +0000
committerLee Jones <lee.jones@linaro.org>2014-01-21 08:28:10 +0000
commitc1ec8fc308bb8171c76b5bed7f4028b6290e53f9 (patch)
treecae119ca4ac650a4e0ca1e3822115a4c87b5ac77 /drivers/mfd
parentdb9ef449aaa550389008c2020fba02e4440ce24b (diff)
downloadop-kernel-dev-c1ec8fc308bb8171c76b5bed7f4028b6290e53f9.zip
op-kernel-dev-c1ec8fc308bb8171c76b5bed7f4028b6290e53f9.tar.gz
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>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/max8997.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/mfd/max8997.c b/drivers/mfd/max8997.c
index 1b80e51..1014169 100644
--- a/drivers/mfd/max8997.c
+++ b/drivers/mfd/max8997.c
@@ -228,18 +228,19 @@ static int max8997_i2c_probe(struct i2c_client *i2c,
max8997_irq_init(max8997);
- mfd_add_devices(max8997->dev, -1, max8997_devs,
+ ret = mfd_add_devices(max8997->dev, -1, max8997_devs,
ARRAY_SIZE(max8997_devs),
NULL, 0, NULL);
+ if (ret < 0) {
+ dev_err(max8997->dev, "failed to add MFD devices %d\n", ret);
+ goto err_mfd;
+ }
/*
* TODO: enable others (flash, muic, rtc, battery, ...) and
* check the return value
*/
- if (ret < 0)
- goto err_mfd;
-
/* MAX8997 has a power button input. */
device_init_wakeup(max8997->dev, pdata->wakeup);
OpenPOWER on IntegriCloud