Skip to contentSkip to conversation

mfd: (max8997) Handle the potential error for mfd_add_devices

PATCH In review Laszlo Papp 2 participants 2 messages Dec 16, 2013 Multifunction devices (MFD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: (max8997) Handle the potential error for mfd_add_devices

---
 drivers/mfd/max8997.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/mfd/max8997.c +5 -5
index 791aea3..ace1a2b 100644
@@ -227,19 +227,19 @@ static int max8997_i2c_probe(struct i2c_client *i2c,
 	pm_runtime_set_active(max8997->dev);
 
 	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, "cannot add mfd cells\n");
+		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);
 
Signature · 1 line
1.8.5.1
#1 lore raw

The $SUBJECT line does not conform to what's expected of MFD commits.

The $SUBJECT line is vague and you are missing a commit body.

Please read:
Documentation/SubmittingPatches

Specifically No2.

Quoted 10 lines
---
 drivers/mfd/max8997.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/mfd/max8997.c +0 -0
index 791aea3..ace1a2b 100644

drivers/mfd/max8997.c static int max8997_i2c_probe(struct i2c_client *i2c, · line 230

Quoted 4 lines
drivers/mfd/max8997.c +0 -1
@@ -227,19 +227,19 @@ static int max8997_i2c_probe(struct i2c_client *i2c,
 	pm_runtime_set_active(max8997->dev);
 
 	max8997_irq_init(max8997);
-

Why have you removed this line?

drivers/mfd/max8997.c static int max8997_i2c_probe(struct i2c_client *i2c, · line 234

Quoted 6 lines
drivers/mfd/max8997.c +3 -1
-	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, "cannot add mfd cells\n");

We're adding devices here, not cells.

"failed to add devices"

Quoted 14 lines
drivers/mfd/max8997.c +2 -3
+		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);
 
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog