Simply use ret variable instead.
Also remove unneeded initialize for ret variable.
Signed-off-by: Axel Lin <[email protected]>
---
drivers/regulator/act8865-regulator.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c
index fe2c038..f07be36 100644
--- a/drivers/regulator/act8865-regulator.c
+++ b/drivers/regulator/act8865-regulator.c
@@ -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 */
--
1.9.1
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
Signed-off-by: Axel Lin <[email protected]>
---
drivers/regulator/act8865-regulator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c
index f07be36..e9fea78 100644
--- a/drivers/regulator/act8865-regulator.c
+++ b/drivers/regulator/act8865-regulator.c
@@ -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;
--
1.9.1
On Mon, Jun 30, 2014 at 03:33:25PM +0800, Axel Lin wrote:
> 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
>
> Signed-off-by: Axel Lin <[email protected]>
> ---
> drivers/regulator/act8865-regulator.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c
> index f07be36..e9fea78 100644
> --- a/drivers/regulator/act8865-regulator.c
> +++ b/drivers/regulator/act8865-regulator.c
> @@ -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;
>
> --
> 1.9.1
On Mon, Jun 30, 2014 at 03:32:09PM +0800, Axel Lin wrote:
> Simply use ret variable instead.
> Also remove unneeded initialize for ret variable.
Applied, thanks.