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: <20130227083213.aa234eea89272b09d6551f78@nvidia.com>
Date:	Wed, 27 Feb 2013 08:32:13 +0200
From:	Hiroshi Doyu <hdoyu@...dia.com>
To:	Peter De Schrijver <pdeschrijver@...dia.com>
CC:	"linux-tegra@...r.kernel.org" <linux-tegra@...r.kernel.org>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	Mike Turquette <mturquette@...aro.org>,
	Stephen Warren <swarren@...dia.com>,
	"Prashant Gaikwad" <pgaikwad@...dia.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [REPOST PATCH 1/2] clk: add table lookup to mux

On Fri, 22 Feb 2013 16:02:28 +0100
Peter De Schrijver <pdeschrijver@...dia.com> wrote:

> Add a table lookup feature to the mux clock. Also allow arbitrary masks
> instead of the width. This will be used by some clocks on Tegra114.
>
> Signed-off-by: Peter De Schrijver <pdeschrijver@...dia.com>
....
> @@ -42,7 +43,17 @@ static u8 clk_mux_get_parent(struct clk_hw *hw)
>  	 * val = 0x4 really means "bit 2, index starts at bit 0"
>  	 */
....
> +	if (mux->table) {
> +		int i;
> +
> +		for (i = 0; i < num_parents; i++)
> +			if (mux->table[i] == val)
> +				return i;
> +		if (i == num_parents)
> +			return -EINVAL;
> +	}

Can't we just return after for-loop without checking i == num_parents as below?

+		for (i = 0; i < num_parents; i++) {
+			if (mux->table[i] == val)
+				return i;
+		}
+
+		return -EINVAL;
--
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