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: <20200117212920.GC3036@piout.net>
Date:   Fri, 17 Jan 2020 22:29:20 +0100
From:   Alexandre Belloni <alexandre.belloni@...tlin.com>
To:     Claudiu Beznea <claudiu.beznea@...rochip.com>
Cc:     mturquette@...libre.com, sboyd@...nel.org,
        nicolas.ferre@...rochip.com, ludovic.desroches@...rochip.com,
        linux-clk@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/4] clk: at91: usb: introduce num_parents in driver's
 structure

On 17/01/2020 13:36:49+0200, Claudiu Beznea wrote:
> SAM9X60 USB clock may have up to 3 parents. Save the number of parents in
> driver's data structure and validate against it when setting parent.
> 
> Signed-off-by: Claudiu Beznea <claudiu.beznea@...rochip.com>
Acked-by: Alexandre Belloni <alexandre.belloni@...tlin.com>

> ---
>  drivers/clk/at91/clk-usb.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/at91/clk-usb.c b/drivers/clk/at91/clk-usb.c
> index c0895c993cce..31d5c45e30d7 100644
> --- a/drivers/clk/at91/clk-usb.c
> +++ b/drivers/clk/at91/clk-usb.c
> @@ -25,6 +25,7 @@ struct at91sam9x5_clk_usb {
>  	struct clk_hw hw;
>  	struct regmap *regmap;
>  	u32 usbs_mask;
> +	u8 num_parents;
>  };
>  
>  #define to_at91sam9x5_clk_usb(hw) \
> @@ -110,7 +111,7 @@ static int at91sam9x5_clk_usb_set_parent(struct clk_hw *hw, u8 index)
>  {
>  	struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw);
>  
> -	if (index > 1)
> +	if (index >= usb->num_parents)
>  		return -EINVAL;
>  
>  	regmap_update_bits(usb->regmap, AT91_PMC_USB, usb->usbs_mask, index);
> @@ -215,6 +216,7 @@ _at91sam9x5_clk_register_usb(struct regmap *regmap, const char *name,
>  	usb->hw.init = &init;
>  	usb->regmap = regmap;
>  	usb->usbs_mask = usbs_mask;
> +	usb->num_parents = num_parents;
>  
>  	hw = &usb->hw;
>  	ret = clk_hw_register(NULL, &usb->hw);
> -- 
> 2.7.4
> 

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ