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: <DB3PR0402MB3916F7F7D7CA801F5C0D0610F5ED0@DB3PR0402MB3916.eurprd04.prod.outlook.com>
Date:   Tue, 11 Jun 2019 02:06:22 +0000
From:   Anson Huang <anson.huang@....com>
To:     Stephen Boyd <sboyd@...nel.org>,
        "bjorn.andersson@...aro.org" <bjorn.andersson@...aro.org>,
        "catalin.marinas@....com" <catalin.marinas@....com>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        "dinguyen@...nel.org" <dinguyen@...nel.org>,
        "enric.balletbo@...labora.com" <enric.balletbo@...labora.com>,
        "festevam@...il.com" <festevam@...il.com>,
        "horms+renesas@...ge.net.au" <horms+renesas@...ge.net.au>,
        "jagan@...rulasolutions.com" <jagan@...rulasolutions.com>,
        "kernel@...gutronix.de" <kernel@...gutronix.de>,
        "l.stach@...gutronix.de" <l.stach@...gutronix.de>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "linux-clk@...r.kernel.org" <linux-clk@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "mark.rutland@....com" <mark.rutland@....com>,
        "maxime.ripard@...tlin.com" <maxime.ripard@...tlin.com>,
        "mturquette@...libre.com" <mturquette@...libre.com>,
        "olof@...om.net" <olof@...om.net>,
        "robh+dt@...nel.org" <robh+dt@...nel.org>,
        "s.hauer@...gutronix .de" <s.hauer@...gutronix.de>,
        "shawnguo@...nel.org" <shawnguo@...nel.org>,
        "will.deacon@....com" <will.deacon@....com>,
        Abel Vesa <abel.vesa@....com>,
        Aisheng Dong <aisheng.dong@....com>,
        Jacky Bai <ping.bai@....com>,
        Leonard Crestez <leonard.crestez@....com>
CC:     dl-linux-imx <linux-imx@....com>
Subject: RE: [PATCH V3 3/4] clk: imx: Add support for i.MX8MN clock driver

Hi, Stephen

> -----Original Message-----
> From: Stephen Boyd <sboyd@...nel.org>
> Sent: Monday, June 10, 2019 11:14 PM
> To: bjorn.andersson@...aro.org; catalin.marinas@....com;
> devicetree@...r.kernel.org; dinguyen@...nel.org;
> enric.balletbo@...labora.com; festevam@...il.com;
> horms+renesas@...ge.net.au; jagan@...rulasolutions.com;
> kernel@...gutronix.de; l.stach@...gutronix.de; linux-arm-
> kernel@...ts.infradead.org; linux-clk@...r.kernel.org; linux-
> kernel@...r.kernel.org; mark.rutland@....com;
> maxime.ripard@...tlin.com; mturquette@...libre.com; olof@...om.net;
> robh+dt@...nel.org; s.hauer@...gutronix .de <s.hauer@...gutronix.de>;
> shawnguo@...nel.org; will.deacon@....com; Abel Vesa
> <abel.vesa@....com>; Aisheng Dong <aisheng.dong@....com>; Anson
> Huang <anson.huang@....com>; Jacky Bai <ping.bai@....com>; Leonard
> Crestez <leonard.crestez@....com>
> Cc: dl-linux-imx <linux-imx@....com>
> Subject: RE: [PATCH V3 3/4] clk: imx: Add support for i.MX8MN clock driver
> 
> Quoting Anson Huang (2019-06-08 02:58:18)
> > Hi, Stephen
> >
> > > -----Original Message-----
> > > From: Stephen Boyd <sboyd@...nel.org>
> > > Sent: Saturday, June 8, 2019 2:01 AM
> > > To: bjorn.andersson@...aro.org; catalin.marinas@....com;
> > > devicetree@...r.kernel.org; dinguyen@...nel.org;
> > > enric.balletbo@...labora.com; festevam@...il.com;
> > > horms+renesas@...ge.net.au; jagan@...rulasolutions.com;
> > > kernel@...gutronix.de; l.stach@...gutronix.de; linux-arm-
> > > kernel@...ts.infradead.org; linux-clk@...r.kernel.org; linux-
> > > kernel@...r.kernel.org; mark.rutland@....com;
> > > maxime.ripard@...tlin.com; mturquette@...libre.com; olof@...om.net;
> > > robh+dt@...nel.org; s.hauer@...gutronix .de
> > > robh+<s.hauer@...gutronix.de>;
> > > shawnguo@...nel.org; will.deacon@....com; Abel Vesa
> > > <abel.vesa@....com>; Aisheng Dong <aisheng.dong@....com>; Anson
> > > Huang <anson.huang@....com>; Jacky Bai <ping.bai@....com>;
> Leonard
> > > Crestez <leonard.crestez@....com>
> > > Cc: dl-linux-imx <linux-imx@....com>
> > > Subject: RE: [PATCH V3 3/4] clk: imx: Add support for i.MX8MN clock
> > > driver
> > >
> > > Quoting Anson Huang (2019-06-06 17:50:28)
> > > >
> > > > I will use devm_platform_ioremap_resource() instead of ioremap(),
> > > > and can you be more specific about devmified clk registration?
> > > >
> > >
> > > I mean using things like devm_clk_hw_register().
> >
> > Sorry, I am still a little confused, all the clock
> > register(clk_register()) are via each different clock types like
> > imx_clk_gate4/imx_clk_pll14xx, if using clk_hw_register, means we need
> > to re-write the clock driver using different clk register method, that
> > will make the driver completely different from i.mx8mq/i.mx8mm, they
> > are actually same series of SoC as i.mx8mn, it will introduce many
> confusion, is my understanding correct? And is it OK to just keep what it is
> and make them all aligned?
> >
> 
> Ok, the problem I'm trying to point out is that clk registrations need to be
> undone, i.e. clk_unregister() needs to be called, when the driver fails to
> probe. devm_*() is one way to do this, but if you have other ways of
> removing all the registered clks then that works too. Makes sense?

Yes, it makes sense. Do you think it is OK to add an imx_unregister_clocks() API, then
call it in every place of returning failure in .probe function? If yes, I will add it and also
fix it in i.MX8MQ driver which uses platform driver model but does NOT handle this case. 

        base = devm_platform_ioremap_resource(pdev, 0);
-       if (WARN_ON(IS_ERR(base)))
-               return PTR_ERR(base);
+       if (WARN_ON(IS_ERR(base))) {
+               ret = PTR_ERR(base);
+               goto unregister_clks;
+       }

                pr_err("failed to register clks for i.MX8MN\n");
-               return -EINVAL;
+               goto unregister_clks;
        }

        return 0;
+
+unregister_clks:
+       imx_unregister_clocks(clks, ARRAY_SIZE(clks));
+
+       return ret;

+void imx_unregister_clocks(struct clk *clks[], unsigned int count)
+{
+       unsigned i;
+
+       for (i = 0; i < count; i++)
+               clk_unregister(clks[i]);
+}
+

Thanks,
Anson.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ