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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180416173326.GD1209@codeaurora.org>
Date:   Mon, 16 Apr 2018 11:33:26 -0600
From:   Lina Iyer <ilina@...eaurora.org>
To:     Ulf Hansson <ulf.hansson@...aro.org>
Cc:     "Rafael J . Wysocki" <rjw@...ysocki.net>,
        Sudeep Holla <sudeep.holla@....com>,
        Lorenzo Pieralisi <Lorenzo.Pieralisi@....com>,
        Mark Rutland <mark.rutland@....com>, linux-pm@...r.kernel.org,
        Kevin Hilman <khilman@...nel.org>,
        Lina Iyer <lina.iyer@...aro.org>,
        Rob Herring <robh+dt@...nel.org>,
        Daniel Lezcano <daniel.lezcano@...aro.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Stephen Boyd <sboyd@...nel.org>,
        Juri Lelli <juri.lelli@....com>,
        Geert Uytterhoeven <geert+renesas@...der.be>,
        linux-arm-kernel@...ts.infradead.org,
        linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v7 01/26] PM / Domains: Don't treat zero found compatible
 idle states as an error

On Thu, Apr 12 2018 at 05:14 -0600, Ulf Hansson wrote:
>Instead of returning -EINVAL from of_genpd_parse_idle_states() in case none
>compatible states was found, let's return 0 to indicate success. Assign
>also the out-parameter *states to NULL and *n to 0, to indicate to the
>caller that zero states have been found/allocated.
>
>This enables the caller of of_genpd_parse_idle_states() to easier act on
>the returned error code.
>
>Cc: Lina Iyer <ilina@...eaurora.org>
>Signed-off-by: Ulf Hansson <ulf.hansson@...aro.org>

Reviewed-by: Lina Iyer <ilina@...eaurora.org>

>---
> drivers/base/power/domain.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
>diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
>index 1ea0e25..c2ef944 100644
>--- a/drivers/base/power/domain.c
>+++ b/drivers/base/power/domain.c
>@@ -2331,8 +2331,8 @@ static int genpd_iterate_idle_states(struct device_node *dn,
>  *
>  * Returns the device states parsed from the OF node. The memory for the states
>  * is allocated by this function and is the responsibility of the caller to
>- * free the memory after use. If no domain idle states is found it returns
>- * -EINVAL and in case of errors, a negative error code.
>+ * free the memory after use. If any or zero compatible domain idle states is
>+ * found it returns 0 and in case of errors, a negative error code is returned.
>  */
> int of_genpd_parse_idle_states(struct device_node *dn,
> 			struct genpd_power_state **states, int *n)
>@@ -2341,8 +2341,14 @@ int of_genpd_parse_idle_states(struct device_node *dn,
> 	int ret;
>
> 	ret = genpd_iterate_idle_states(dn, NULL);
>-	if (ret <= 0)
>-		return ret < 0 ? ret : -EINVAL;
>+	if (ret < 0)
>+		return ret;
>+
>+	if (!ret) {
>+		*states = NULL;
>+		*n = 0;
>+		return 0;
>+	}
>
> 	st = kcalloc(ret, sizeof(*st), GFP_KERNEL);
> 	if (!st)
>--
>2.7.4
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ