regulator: Remove a redundant device_remove_file call in create_regulator
PATCH 1/3 regulator: Remove a redundant device_remove_file call in create_regulator
We already have device_remove_file() in error path, no need to call it before goto link_name_err.
--- drivers/regulator/core.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/regulator/core.c +0 -1
@@ -1052,7 +1052,6 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,printk (KERN_WARNING "%s: could not add device link %s err %d\n" , __func__, dev->kobj.name, err); -device_remove_file (dev, ®ulator->dev_attr); goto link_name_err; } }
Signature · 1 line
1.7.2
PATCH 2/3 regulator: Ensure enough delay time for enabling regulator
Integer division will truncate the result, this patch ensures we have enough delay time for enabling regulator.
--- drivers/regulator/core.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/regulator/core.c +3 -2
@@ -1312,9 +1312,10 @@ static int _regulator_enable(struct regulator_dev *rdev)if (ret <0 )return ret; -if (delay >=1000 ) +if (delay >=1000 ) {mdelay (delay /1000 ); -else if (delay) +udelay (delay %1000 ); + }else if (delay)udelay (delay); }else if (ret <0 ) {
Signature · 1 line
1.7.2
Re: [PATCH 2/3] regulator: Ensure enough delay time for enabling regulator
drivers/regulator/core.c static int _regulator_enable(struct regulator_dev *rdev) · line 1319
Quoted 7 lines · Axel Lin
drivers/regulator/core.c +3
-2-if (delay >=1000 ) +if (delay >=1000 ) {mdelay (delay /1000 ); -else if (delay) +udelay (delay %1000 ); + }else if (delay)udelay (delay);
This looks good but please change this to use { } in the else case also; I find this very helpful for legibility.
PATCH 3/3 regulator: Return proper error for regulator_register()
In reply to Axel Lin--- drivers/regulator/core.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/regulator/core.c +2 -0
@@ -2346,6 +2346,7 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,if (init_data->supply_regulator && init_data->supply_regulator_dev) {dev_err (dev,"Supply regulator specified by both name and dev\n" ); + ret = -EINVAL ; goto scrub; }
@@ -2364,6 +2365,7 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,if (!found) {dev_err (dev,"Failed to find supply %s\n" , init_data->supply_regulator); + ret = -ENODEV ; goto scrub; }
Signature · 1 line
1.7.2
Re: [PATCH 3/3] regulator: Return proper error for regulator_register()
Quoted 1 line · Axel Lin
Signed-off-by Axel Lin <[email protected]>
Quoted 4 lines · Axel Lin
We already have
device_remove_file()in error path, no need to call it before gotolink_name_err.Signed-off-by Axel Lin <[email protected]>