Skip to contentSkip to conversation

regulator: uniphier: Fix probe error handling

PATCH In review Axel Lin 2 participants 4 messages Jan 30, 2019

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/2 regulator: uniphier: Fix probe error handling

Ensure unwind all resources if probe fails.

---
 drivers/regulator/uniphier-regulator.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/regulator/uniphier-regulator.c +4 -2
index abf22acbd13e..6ba0ae405f2b 100644
@@ -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
author
#1 lore raw

PATCH 2/2 regulator: uniphier: Constify uniphier_regulator_ops

---
 drivers/regulator/uniphier-regulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/uniphier-regulator.c +1 -1
index 6ba0ae405f2b..9026d5a3e964 100644
@@ -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
maintainer Reviewed-by on v1 2/2
#2 lore raw

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:
---
 drivers/regulator/uniphier-regulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/uniphier-regulator.c +0 -0
index 6ba0ae405f2b..9026d5a3e964 100644

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,

Thank you,

---
Best Regards,
Kunihiko Hayashi

maintainer Reviewed-by on v1 1/2
#3 lore raw
In reply to Axel Lin

Hi Axel,

Quoted 12 lines · On Wed, 30 Jan 2019 15:11:09 +0800 <[email protected]> wrote:

Ensure unwind all resources if probe fails.

---
 drivers/regulator/uniphier-regulator.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/regulator/uniphier-regulator.c +0 -0
index abf22acbd13e..6ba0ae405f2b 100644

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.

Thank you,

---
Best Regards,
Kunihiko Hayashi