[PATCH] Added braces to if conditionals to make it more clearer and to prevent errors

Biancaa Ramesh posted 1 patch 3 months, 2 weeks ago
.../marvell/pxa1908-power-controller.c        | 35 ++++++++++++-------
1 file changed, 23 insertions(+), 12 deletions(-)
[PATCH] Added braces to if conditionals to make it more clearer and to prevent errors
Posted by Biancaa Ramesh 3 months, 2 weeks ago
Signed-off-by: Biancaa Ramesh <biancaa2210329@ssn.edu.in>
---
 .../marvell/pxa1908-power-controller.c        | 35 ++++++++++++-------
 1 file changed, 23 insertions(+), 12 deletions(-)

diff --git a/drivers/pmdomain/marvell/pxa1908-power-controller.c b/drivers/pmdomain/marvell/pxa1908-power-controller.c
index ff5e6e82d3f8..a48f33d07812 100644
--- a/drivers/pmdomain/marvell/pxa1908-power-controller.c
+++ b/drivers/pmdomain/marvell/pxa1908-power-controller.c
@@ -73,15 +73,17 @@ static int pxa1908_pd_power_on(struct generic_pm_domain *genpd)
 	int ret = 0;
 
 	regmap_set_bits(ctrl->base, data->reg_clk_res_ctrl, data->hw_mode);
-	if (data->id != PXA1908_POWER_DOMAIN_ISP)
+	if (data->id != PXA1908_POWER_DOMAIN_ISP){
 		regmap_write(ctrl->base, APMU_PWR_BLK_TMR_REG, 0x20001fff);
+	}
 	regmap_set_bits(ctrl->base, APMU_PWR_CTRL_REG, data->pwr_state);
 
 	ret = regmap_read_poll_timeout(ctrl->base, APMU_PWR_STATUS_REG, status,
 				       status & data->pwr_state, POWER_POLL_SLEEP_US,
 				       POWER_ON_LATENCY_US + POWER_POLL_TIMEOUT_US);
-	if (ret == -ETIMEDOUT)
+	if (ret == -ETIMEDOUT){
 		dev_err(ctrl->dev, "timed out powering on domain '%s'\n", pd->genpd.name);
+	}
 
 	return ret;
 }
@@ -169,16 +171,19 @@ static void pxa1908_pd_remove(struct auxiliary_device *auxdev)
 	for (int i = NR_DOMAINS - 1; i >= 0; i--) {
 		pd = &domains[i];
 
-		if (!pd->initialized)
+		if (!pd->initialized){
 			continue;
+		}
 
-		if (pxa1908_pd_is_on(pd) && !pd->data.keep_on)
+		if (pxa1908_pd_is_on(pd) && !pd->data.keep_on){
 			pxa1908_pd_power_off(&pd->genpd);
+		}
 
 		ret = pm_genpd_remove(&pd->genpd);
-		if (ret)
-			dev_err(&auxdev->dev, "failed to remove domain '%s': %d\n",
+		if (ret){
+				dev_err(&auxdev->dev, "failed to remove domain '%s': %d\n",
 				pd->genpd.name, ret);
+		}
 	}
 }
 
@@ -195,9 +200,10 @@ pxa1908_pd_init(struct pxa1908_pd_ctrl *ctrl, int id, struct device *dev)
 	/* Make sure the state of the hardware is synced with the domain table above. */
 	if (pd->data.keep_on) {
 		ret = pd->genpd.power_on(&pd->genpd);
-		if (ret)
+		if (ret){
 			return dev_err_probe(dev, ret, "failed to power on domain '%s'\n",
 					     pd->genpd.name);
+		}
 	} else {
 		if (pxa1908_pd_is_on(pd)) {
 			dev_warn(dev,
@@ -205,17 +211,19 @@ pxa1908_pd_init(struct pxa1908_pd_ctrl *ctrl, int id, struct device *dev)
 				 pd->genpd.name);
 
 			ret = pd->genpd.power_off(&pd->genpd);
-			if (ret)
+			if (ret){
 				return dev_err_probe(dev, ret,
 						     "failed to power off domain '%s'\n",
 						     pd->genpd.name);
+			}
 		}
 	}
 
 	ret = pm_genpd_init(&pd->genpd, NULL, !pd->data.keep_on);
-	if (ret)
+	if (ret){
 		return dev_err_probe(dev, ret, "domain '%s' failed to initialize\n",
 				     pd->genpd.name);
+	}
 
 	pd->initialized = true;
 
@@ -230,14 +238,16 @@ pxa1908_pd_probe(struct auxiliary_device *auxdev, const struct auxiliary_device_
 	int ret;
 
 	ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL);
-	if (!ctrl)
+	if (!ctrl){
 		return -ENOMEM;
+	}
 
 	auxiliary_set_drvdata(auxdev, ctrl);
 
 	ctrl->base = syscon_node_to_regmap(dev->parent->of_node);
-	if (IS_ERR(ctrl->base))
+	if (IS_ERR(ctrl->base)){
 		return dev_err_probe(dev, PTR_ERR(ctrl->base), "no regmap available\n");
+	}
 
 	ctrl->dev = dev;
 	ctrl->onecell_data.domains = ctrl->domains;
@@ -245,8 +255,9 @@ pxa1908_pd_probe(struct auxiliary_device *auxdev, const struct auxiliary_device_
 
 	for (int i = 0; i < NR_DOMAINS; i++) {
 		ret = pxa1908_pd_init(ctrl, i, dev);
-		if (ret)
+		if (ret){
 			goto err;
+		}
 	}
 
 	return of_genpd_add_provider_onecell(dev->parent->of_node, &ctrl->onecell_data);
-- 
2.43.0


-- 
::DISCLAIMER::

---------------------------------------------------------------------
The 
contents of this e-mail and any attachment(s) are confidential and
intended 
for the named recipient(s) only. Views or opinions, if any,
presented in 
this email are solely those of the author and may not
necessarily reflect 
the views or opinions of SSN Institutions (SSN) or its
affiliates. Any form 
of reproduction, dissemination, copying, disclosure,
modification, 
distribution and / or publication of this message without the
prior written 
consent of authorized representative of SSN is strictly
prohibited. If you 
have received this email in error please delete it and
notify the sender 
immediately.
---------------------------------------------------------------------
Header of this mail should have a valid DKIM signature for the domain 
ssn.edu.in <http://www.ssn.edu.in/>