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: <4F867459.20806@st.com>
Date:	Thu, 12 Apr 2012 11:51:13 +0530
From:	Viresh Kumar <viresh.kumar@...com>
To:	Mike Turquette <mturquette@...aro.org>
Cc:	"arnd.bergmann@...aro.org" <arnd.bergmann@...aro.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	"linaro-dev@...ts.linaro.org" <linaro-dev@...ts.linaro.org>,
	"patches@...aro.org" <patches@...aro.org>,
	Rajendra Nayak <rnayak@...com>,
	Olof Johansson <olof@...om.net>,
	Russell King <linux@....linux.org.uk>,
	Sascha Hauer <s.hauer@...gutronix.de>,
	Shawn Guo <shawn.guo@...escale.com>,
	Richard Zhao <richard.zhao@...aro.org>,
	Saravana Kannan <skannan@...eaurora.org>,
	Mark Brown <broonie@...nsource.wolfsonmicro.com>,
	Andrew Lunn <andrew@...n.ch>
Subject: Re: [PATCH 09/13] clk: Make clk_get_rate() return 0 on error

On 4/12/2012 6:32 AM, Mike Turquette wrote:
> From: Rajendra Nayak <rnayak@...com>
> 
> Most users of clk_get_rate() actually assume a non zero
> return value as a valid rate returned. Returing -EINVAL
> might confuse such users, so make it instead return zero
> on error.
> 
> Besides the return value of clk_get_rate seems to be
> 'unsigned long'.
> 
> Signed-off-by: Rajendra nayak <rnayak@...com>
> Signed-off-by: Mike Turquette <mturquette@...aro.org>
> Cc: Arnd Bergman <arnd.bergmann@...aro.org>
> Cc: Olof Johansson <olof@...om.net>
> Cc: Russell King <linux@....linux.org.uk>
> Cc: Sascha Hauer <s.hauer@...gutronix.de>
> Cc: Shawn Guo <shawn.guo@...escale.com>
> Cc: Richard Zhao <richard.zhao@...aro.org>
> Cc: Saravana Kannan <skannan@...eaurora.org>
> Cc: Mark Brown <broonie@...nsource.wolfsonmicro.com>
> Cc: Andrew Lunn <andrew@...n.ch>
> Cc: Viresh Kumar <viresh.kumar@...com>
> ---
>  drivers/clk/clk.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 9924aec..a24b121 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -285,7 +285,7 @@ unsigned long __clk_get_rate(struct clk *clk)
>  	unsigned long ret;
>  
>  	if (!clk) {
> -		ret = -EINVAL;
> +		ret = 0;
>  		goto out;
>  	}
>  
> @@ -295,7 +295,7 @@ unsigned long __clk_get_rate(struct clk *clk)
>  		goto out;
>  
>  	if (!clk->parent)
> -		ret = -ENODEV;
> +		ret = 0;
>  
>  out:
>  	return ret;
> @@ -560,7 +560,7 @@ EXPORT_SYMBOL_GPL(clk_enable);
>   * @clk: the clk whose rate is being returned
>   *
>   * Simply returns the cached rate of the clk.  Does not query the hardware.  If
> - * clk is NULL then returns -EINVAL.
> + * clk is NULL then returns 0.
>   */
>  unsigned long clk_get_rate(struct clk *clk)
>  {

Reviewed-by: Viresh Kumar <viresh.kumar@...com>

-- 
viresh
--
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