regulator: uniphier: Fix probe error handling
PATCH 1/2 regulator: uniphier: Fix probe error handling
Ensure unwind all resources if probe fails.
Signed-off-by Axel Lin <[email protected]>
--- drivers/regulator/uniphier-regulator.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/regulator/uniphier-regulator.c +4 -2
@@ -87,8 +87,10 @@ static int uniphier_regulator_probe(struct platform_device *pdev) } regmap =devm_regmap_init_mmio (dev, base, priv->data->regconf); -if (IS_ERR (regmap)) -return PTR_ERR (regmap); +if (IS_ERR (regmap)) { + ret =PTR_ERR (regmap); + goto out_rst_assert; + } config.dev = dev; config.driver_data = priv;
Signature · 1 line
2.17.1
PATCH 2/2 regulator: uniphier: Constify uniphier_regulator_ops
Signed-off-by Axel Lin <[email protected]>
--- drivers/regulator/uniphier-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/uniphier-regulator.c +1 -1
@@ -32,7 +32,7 @@ struct uniphier_regulator_priv {const struct uniphier_regulator_soc_data *data; }; -static struct regulator_ops uniphier_regulator_ops = { +static const struct regulator_ops uniphier_regulator_ops = { .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, .is_enabled = regulator_is_enabled_regmap,
Signature · 1 line
2.17.1
Re: [PATCH 2/2] regulator: uniphier: Constify uniphier_regulator_ops
Quoted 10 lines · On Wed, 30 Jan 2019 15:11:10 +0800 <[email protected]> wrote:
Signed-off-by Axel Lin <[email protected]>--- drivers/regulator/uniphier-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/regulator/uniphier-regulator.c +0
-0
drivers/regulator/uniphier-regulator.c struct uniphier_regulator_priv { · line 38
Quoted 8 lines
drivers/regulator/uniphier-regulator.c +1
-1@@ -32,7 +32,7 @@ struct uniphier_regulator_priv {const struct uniphier_regulator_soc_data *data; }; -static struct regulator_ops uniphier_regulator_ops = { +static const struct regulator_ops uniphier_regulator_ops = { .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, .is_enabled = regulator_is_enabled_regmap,
Reviewed-by Kunihiko Hayashi <[email protected]>
Thank you,
---
Best Regards,
Kunihiko Hayashi
Hi Axel,
Quoted 12 lines · On Wed, 30 Jan 2019 15:11:09 +0800 <[email protected]> wrote:
Ensure unwind all resources if probe fails.
Signed-off-by Axel Lin <[email protected]>--- drivers/regulator/uniphier-regulator.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/regulator/uniphier-regulator.c +0
-0
drivers/regulator/uniphier-regulator.c static int uniphier_regulator_probe(struct platform_device *pdev) · line 93
Quoted 9 lines
drivers/regulator/uniphier-regulator.c +4
-2@@ -87,8 +87,10 @@ static int uniphier_regulator_probe(struct platform_device *pdev) } regmap =devm_regmap_init_mmio (dev, base, priv->data->regconf); -if (IS_ERR (regmap)) -return PTR_ERR (regmap); +if (IS_ERR (regmap)) { + ret =PTR_ERR (regmap); + goto out_rst_assert; + }
Surely this return without asserting resets is wrong. This looks good to me.
Reviewed-by Kunihiko Hayashi <[email protected]>
Thank you,
---
Best Regards,
Kunihiko Hayashi