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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AM0PR04MB42110066C43E037F2E0501CB80690@AM0PR04MB4211.eurprd04.prod.outlook.com>
Date:   Fri, 25 May 2018 09:49:45 +0000
From:   "A.s. Dong" <aisheng.dong@....com>
To:     Stephen Boyd <sboyd@...nel.org>,
        "linux-clk@...r.kernel.org" <linux-clk@...r.kernel.org>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "mturquette@...libre.com" <mturquette@...libre.com>,
        "hdegoede@...hat.com" <hdegoede@...hat.com>,
        "b.zolnierkie@...sung.com" <b.zolnierkie@...sung.com>,
        "linux@...linux.org.uk" <linux@...linux.org.uk>,
        "linux-fbdev@...r.kernel.org" <linux-fbdev@...r.kernel.org>,
        dl-linux-imx <linux-imx@....com>,
        Stephen Boyd <sboyd@...eaurora.org>,
        Masahiro Yamada <yamada.masahiro@...ionext.com>
Subject: RE: [PATCH V2 2/4] clk: add new APIs to operate on all available
 clocks

> -----Original Message-----
> From: Stephen Boyd [mailto:sboyd@...nel.org]
> Sent: Saturday, March 24, 2018 12:57 AM
> To: A.s. Dong <aisheng.dong@....com>; linux-clk@...r.kernel.org
> Cc: linux-kernel@...r.kernel.org; linux-arm-kernel@...ts.infradead.org;
> mturquette@...libre.com; hdegoede@...hat.com;
> b.zolnierkie@...sung.com; linux@...linux.org.uk; linux-
> fbdev@...r.kernel.org; dl-linux-imx <linux-imx@....com>; A.s. Dong
> <aisheng.dong@....com>; Stephen Boyd <sboyd@...eaurora.org>;
> Masahiro Yamada <yamada.masahiro@...ionext.com>
> Subject: Re: [PATCH V2 2/4] clk: add new APIs to operate on all available
> clocks
> 
> Quoting Dong Aisheng (2018-03-20 20:19:49)
> > @@ -50,6 +52,38 @@ static int __must_check of_clk_bulk_get(struct
> device_node *np, int num_clks,
> >         return ret;
> >  }
> >  EXPORT_SYMBOL(of_clk_bulk_get);
> > +
> > +static int __must_check of_clk_bulk_get_all(struct device_node *np,
> > +                                           struct clk_bulk_data
> > +**clks) {
> > +       struct clk_bulk_data *clk_bulk;
> > +       int num_clks;
> > +       int ret;
> > +
> > +       num_clks = of_clk_get_parent_count(np);
> > +       if (!num_clks)
> > +               return 0;
> > +
> > +       clk_bulk = kcalloc(num_clks, sizeof(*clk_bulk), GFP_KERNEL);
> 
> Can be kmalloc_array? of_clk_bulk_get() already clears things out
> appropriately.

Yes, indeed. Will use kmalloc_array instead.

> 
> > +       if (!clk_bulk)
> > +               return -ENOMEM;
> > +
> > +       ret = of_clk_bulk_get(np, num_clks, clk_bulk);
> > +       if (ret) {
> > +               kfree(clk_bulk);
> > +               return ret;
> > +       }
> > +
> > +       *clks = clk_bulk;
> > +
> > +       return num_clks;
> > +}
> > +#else
> > +static int __must_check of_clk_bulk_get_all(struct device_node *np,
> > +                                           struct clk_bulk_data
> > +**clks) {
> > +       return -ENOENT;
> > +}
> >  #endif
> 
> This else can probably be dropped too.
> 

Right.

> >
> >  void clk_bulk_put(int num_clks, struct clk_bulk_data *clks) @@ -90,6
> > +124,29 @@ int __must_check clk_bulk_get(struct device *dev, int
> > num_clks,  }  EXPORT_SYMBOL(clk_bulk_get);
> >
> > +void clk_bulk_put_all(int num_clks, struct clk_bulk_data *clks) {
> > +       if (IS_ERR_OR_NULL(clks))
> > +               return;
> > +
> > +       clk_bulk_put(num_clks, clks);
> > +
> > +       kfree(clks);
> > +}
> > +EXPORT_SYMBOL(clk_bulk_put_all);
> > +
> > +int __must_check clk_bulk_get_all(struct device *dev,
> > +                                 struct clk_bulk_data **clks) {
> > +       struct device_node *np = dev_of_node(dev);
> > +
> > +       if (!np)
> > +               return 0;
> > +
> > +       return of_clk_bulk_get_all(np, clks); }
> > +EXPORT_SYMBOL(clk_bulk_get_all);
> 
> Looks better!

Thanks

Regards
Dong Aisheng

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ