lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 11 Aug 2015 08:03:49 +0530
From:	Viresh Kumar <viresh.kumar@...aro.org>
To:	Stephen Boyd <sboyd@...eaurora.org>
Cc:	Rafael Wysocki <rjw@...ysocki.net>, nm@...com,
	linaro-kernel@...ts.linaro.org, linux-pm@...r.kernel.org,
	khilman@...aro.org,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Len Brown <len.brown@...el.com>,
	open list <linux-kernel@...r.kernel.org>,
	Pavel Machek <pavel@....cz>
Subject: Re: [PATCH 2/6] PM / OPP: restructure _of_init_opp_table_v2()

On 10-08-15, 17:31, Stephen Boyd wrote:
> I am not insisting anything. But another patch to get rid of the
> goto sounds fine.

The separate patch to kill goto.

---------------------8<-------------------------

Message-Id: <9f9b9ea6ea3685d5f71c132e7efb18917253961f.1439260355.git.viresh.kumar@...aro.org>
From: Viresh Kumar <viresh.kumar@...aro.org>
Date: Tue, 11 Aug 2015 08:01:01 +0530
Subject: [PATCH] PM / OPP: Remove unnecessary goto statements

The code simply returns after jumping to the out label and doesn't free
any resources, etc.

Kill the unnecessary goto statements.

Signed-off-by: Viresh Kumar <viresh.kumar@...aro.org>
---
 drivers/base/power/opp.c | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
index f42e098b71fe..220e8d77e2c4 100644
--- a/drivers/base/power/opp.c
+++ b/drivers/base/power/opp.c
@@ -1269,14 +1269,14 @@ static int _of_init_opp_table_v2(struct device *dev,
 {
 	struct device_node *np;
 	struct device_opp *dev_opp;
-	int ret = 0, count = 0;
+	int ret, count = 0;
 
 	dev_opp = _managed_opp(opp_np);
 	if (dev_opp) {
 		/* OPPs are already managed */
 		if (!_add_list_dev(dev, dev_opp))
-			ret = -ENOMEM;
-		goto out;
+			return -ENOMEM;
+		return 0;
 	}
 
 	/* We have opp-list node now, iterate over it and add OPPs */
@@ -1287,31 +1287,24 @@ static int _of_init_opp_table_v2(struct device *dev,
 		if (ret) {
 			dev_err(dev, "%s: Failed to add OPP, %d\n", __func__,
 				ret);
-			break;
+			of_free_opp_table(dev);
+			return ret;
 		}
 	}
 
 	/* There should be one of more OPP defined */
 	if (WARN_ON(!count))
-		goto out;
-
-	if (ret) {
-		of_free_opp_table(dev);
-		goto out;
-	}
+		return -ENOENT;
 
 	dev_opp = _find_device_opp(dev);
-	if (WARN_ON(!dev_opp)) {
-		ret = -EINVAL;
-		goto out;
-	}
+	if (WARN_ON(!dev_opp))
+		return -EINVAL;
 
 	dev_opp->np = opp_np;
 	dev_opp->shared_opp = of_property_read_bool(opp_np,
 			"opp-shared");
 
-out:
-	return ret;
+	return 0;
 }
 
 /* Initializes OPP tables based on old-deprecated bindings */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ