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: <20180926064752.GM4097@pengutronix.de>
Date:   Wed, 26 Sep 2018 08:47:52 +0200
From:   Sascha Hauer <s.hauer@...gutronix.de>
To:     Fabio Estevam <festevam@...il.com>
Cc:     Abel Vesa <abel.vesa@....com>,
        Lucas Stach <l.stach@...gutronix.de>,
        Sascha Hauer <kernel@...gutronix.de>,
        Dong Aisheng <aisheng.dong@....com>,
        Fabio Estevam <fabio.estevam@....com>,
        Anson Huang <anson.huang@....com>,
        Andrey Smirnov <andrew.smirnov@...il.com>,
        Rob Herring <robh@...nel.org>, Stephen Boyd <sboyd@...nel.org>,
        Michael Turquette <mturquette@...libre.com>,
        open list <linux-kernel@...r.kernel.org>,
        "open list:COMMON CLK FRAMEWORK" <linux-clk@...r.kernel.org>,
        Abel Vesa <abelvesa@...ux.com>,
        NXP Linux Team <linux-imx@....com>,
        Shawn Guo <shawnguo@...nel.org>,
        "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" 
        <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH v9 4/5] clk: imx: add imx composite clock

On Tue, Sep 25, 2018 at 01:42:12PM -0300, Fabio Estevam wrote:
> Hi Abel,
> 
> On Mon, Sep 24, 2018 at 7:39 AM, Abel Vesa <abel.vesa@....com> wrote:
> 
> > +static long imx_clk_composite_divider_round_rate(struct clk_hw *hw,
> > +                                               unsigned long rate,
> > +                                               unsigned long *prate)
> > +{
> > +       int prediv_value;
> > +       int div_value;
> > +
> > +       imx_clk_composite_compute_dividers(rate, *prate,
> > +                                               &prediv_value, &div_value);
> > +
> > +       rate = DIV_ROUND_UP_ULL((u64)*prate, prediv_value);
> 
> You assing a value to 'rate' here.
> 
> > +       rate = DIV_ROUND_UP_ULL((u64)rate, div_value);
> 
> And then overwrite it immediately after.

It's:
	rate = *prate / prediv_value;
	rate = rate / div_value;

To me this looks correct. However, For an unsigned long type we have
DIV_ROUND_UP() with which we do not need any casting. For 64bit code
unsigned long is 64bit anyway which makes the cast a no-op and for 32bit
code there's also no point in exanding the initial 32bit value to 64bit.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ