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: <155293884206.20095.9858756917267939797@swboyd.mtv.corp.google.com>
Date:   Mon, 18 Mar 2019 12:54:02 -0700
From:   Stephen Boyd <sboyd@...nel.org>
To:     Nicolas Ferre <nicolas.ferre@...rochip.com>,
        linux-clk@...r.kernel.org
Cc:     Alexandre Belloni <alexandre.belloni@...tlin.com>,
        Ludovic Desroches <ludovic.desroches@...rochip.com>,
        Claudiu Beznea <claudiu.beznea@...rochip.com>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        mturquette@...libre.com, matthias.wieloch@...-bauer.de,
        stable@...r.kernel.org, Nicolas Ferre <nicolas.ferre@...rochip.com>
Subject: Re: [PATCH v2] clk: at91: fix programmable clock for sama5d2

Quoting Nicolas Ferre (2019-03-18 03:50:45)
> From: Matthias Wieloch <matthias.wieloch@...-bauer.de>
> 
> The prescaler formula of the programmable clock has changed for sama5d2. Update
> the driver accordingly.
> 
> Fixes: a2038077de9a ("clk: at91: add sama5d2 PMC driver")
> Cc: <stable@...r.kernel.org> # v4.20+
> Signed-off-by: Nicolas Ferre <nicolas.ferre@...rochip.com>
> [nicolas.ferre@...rochip.com: adapt the prescaler range,
>                 fix clk_programmable_recalc_rate, split patch]
> Signed-off-by: Matthias Wieloch <matthias.wieloch@...-bauer.de>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@...tlin.com>
> ---
> v2: adapt to v5.1-rc1
>     remove unneeded sentence about DT in commit message
> 
> Stephen,
> 
> I think it would be good to see this fix going upstream during v5.1-rc phase.

Ok. I can apply this clk-fixes. I presume that things are real bad and
it can't wait until v5.2?

> @@ -60,10 +68,18 @@ static int clk_programmable_determine_rate(struct clk_hw *hw,
>                         continue;
>  
>                 parent_rate = clk_hw_get_rate(parent);
> -               for (shift = 0; shift < PROG_PRES_MASK; shift++) {
> -                       tmp_rate = parent_rate >> shift;
> -                       if (tmp_rate <= req->rate)
> -                               break;
> +               if (layout->is_pres_direct) {
> +                       for (shift = 0; shift <= layout->pres_mask; shift++) {
> +                               tmp_rate = parent_rate / (shift + 1);
> +                               if (tmp_rate <= req->rate)
> +                                       break;
> +                       }
> +               } else {
> +                       for (shift = 0; shift < layout->pres_mask; shift++) {
> +                               tmp_rate = parent_rate >> shift;
> +                               if (tmp_rate <= req->rate)
> +                                       break;
> +                       }

This looks like a lot of copy paste when the if statement could have been
pulled into the for loop instead of duplicating the loops and
surrounding if condition check for tmp_rate.

>                 }
>  
>                 if (tmp_rate > req->rate)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ