Skip to contentSkip to conversation

regulator: act8865: Remove error variable in act8865_pmic_probe

PATCH Applied Axel Lin 3 participants 4 messages Jun 30, 2014 – Jul 2, 2014 Voltage and current regulator framework

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/2 regulator: act8865: Remove error variable in act8865_pmic_probe

Simply use ret variable instead.
Also remove unneeded initialize for ret variable.

---
 drivers/regulator/act8865-regulator.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/regulator/act8865-regulator.c +4 -5
index fe2c038..f07be36 100644
@@ -278,8 +278,7 @@ static int act8865_pmic_probe(struct i2c_client *client,
 	struct act8865 *act8865;
 	struct device_node *of_node[ACT8865_REG_NUM];
 	int i;
-	int ret = -EINVAL;
-	int error;
+	int ret;
 
 	if (dev->of_node && !pdata) {
 		const struct of_device_id *id;
@@ -307,10 +306,10 @@ static int act8865_pmic_probe(struct i2c_client *client,
 
 	act8865->regmap = devm_regmap_init_i2c(client, &act8865_regmap_config);
 	if (IS_ERR(act8865->regmap)) {
-		error = PTR_ERR(act8865->regmap);
+		ret = PTR_ERR(act8865->regmap);
 		dev_err(&client->dev, "Failed to allocate register map: %d\n",
-			error);
-		return error;
+			ret);
+		return ret;
 	}
 
 	/* Finally register devices */
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 2/2 regulator: act8865: Explictly initialize of_node array

Silence below build warning:
CC [M] drivers/regulator/act8865-regulator.o
drivers/regulator/act8865-regulator.c: In function ‘act8865_pmic_probe’:
drivers/regulator/act8865-regulator.c:321: warning: ‘of_node’ may be used uninitialized in this function

---
 drivers/regulator/act8865-regulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/act8865-regulator.c +1 -1
index f07be36..e9fea78 100644
@@ -276,7 +276,7 @@ static int act8865_pmic_probe(struct i2c_client *client,
 	struct act8865_platform_data *pdata = dev_get_platdata(dev);
 	struct regulator_config config = { };
 	struct act8865 *act8865;
-	struct device_node *of_node[ACT8865_REG_NUM];
+	struct device_node *of_node[ACT8865_REG_NUM] = { };
 	int i;
 	int ret;
 
Signature · 1 line
1.9.1
#2 lore raw

Re: [PATCH 2/2] regulator: act8865: Explictly initialize of_node array

Quoted 4 lines · Axel Lin

Silence below build warning:
CC [M] drivers/regulator/act8865-regulator.o
drivers/regulator/act8865-regulator.c: In function ‘act8865_pmic_probe’:
drivers/regulator/act8865-regulator.c:321: warning: ‘of_node’ may be used uninitialized in this function

Hi Axel,

some days ago I submitted a patch series that adds support for other act88xx chips to the driver and reworks the probe function, also indirectly fixing the warning about uninitialized of_node:

http://lists.infradead.org/pipermail/linux-arm-kernel/2014-June/265477.html

Beniamino

Quoted 21 lines
---
 drivers/regulator/act8865-regulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/act8865-regulator.c +1 -1
index f07be36..e9fea78 100644
@@ -276,7 +276,7 @@ static int act8865_pmic_probe(struct i2c_client *client,
 	struct act8865_platform_data *pdata = dev_get_platdata(dev);
 	struct regulator_config config = { };
 	struct act8865 *act8865;
-	struct device_node *of_node[ACT8865_REG_NUM];
+	struct device_node *of_node[ACT8865_REG_NUM] = { };
 	int i;
 	int ret;
 
Signature · 1 line
1.9.1
maintainer Applied
#3 lore raw
In reply to Axel Lin
Quoted 2 lines · Axel Lin

Simply use ret variable instead.
Also remove unneeded initialize for ret variable.

Applied, thanks.