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]
Date:	Fri, 8 Feb 2013 10:51:31 +0530
From:	Prashant Gaikwad <pgaikwad@...dia.com>
To:	Peter De Schrijver <pdeschrijver@...dia.com>
CC:	Stephen Warren <swarren@...dia.com>,
	Mike Turquette <mturquette@...aro.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] clk: tegra: Implement locking for super clock

On Thursday 07 February 2013 09:54 PM, Peter De Schrijver wrote:
> Although tegra_clk_register_super_mux() has a lock parameter, the lock is not
> actually used by the code. Fixed with this patch.
>
> Signed-off-by: Peter De Schrijver <pdeschrijver@...dia.com>

Reviewed-by: Prashant Gaikwad <pgaikwad@...dia.com>

> ---
>   drivers/clk/tegra/clk-super.c |   18 +++++++++++++++---
>   1 files changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/clk/tegra/clk-super.c b/drivers/clk/tegra/clk-super.c
> index 7ad48a8..2fd924d 100644
> --- a/drivers/clk/tegra/clk-super.c
> +++ b/drivers/clk/tegra/clk-super.c
> @@ -73,7 +73,12 @@ static int clk_super_set_parent(struct clk_hw *hw, u8 index)
>   {
>   	struct tegra_clk_super_mux *mux = to_clk_super_mux(hw);
>   	u32 val, state;
> +	int err = 0;
>   	u8 parent_index, shift;
> +	unsigned long flags = 0;
> +
> +	if (mux->lock)
> +		spin_lock_irqsave(mux->lock, flags);
>   
>   	val = readl_relaxed(mux->reg);
>   	state = val & SUPER_STATE_MASK;
> @@ -92,8 +97,10 @@ static int clk_super_set_parent(struct clk_hw *hw, u8 index)
>   					       (index == mux->pllx_index))) {
>   		parent_index = clk_super_get_parent(hw);
>   		if ((parent_index == mux->div2_index) ||
> -		    (parent_index == mux->pllx_index))
> -			return -EINVAL;
> +		    (parent_index == mux->pllx_index)) {
> +			err = -EINVAL;
> +			goto out;
> +		}
>   
>   		val ^= SUPER_LP_DIV2_BYPASS;
>   		writel_relaxed(val, mux->reg);
> @@ -107,7 +114,12 @@ static int clk_super_set_parent(struct clk_hw *hw, u8 index)
>   
>   	writel_relaxed(val, mux->reg);
>   	udelay(2);
> -	return 0;
> +
> +out:
> +	if (mux->lock)
> +		spin_unlock_irqrestore(mux->lock, flags);
> +
> +	return err;
>   }
>   
>   const struct clk_ops tegra_clk_super_ops = {

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