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: <CAHp75Ve2_UcS9e3pJC2j4FBc21=S8878tQusyxNV1mXtQG423w@mail.gmail.com>
Date:   Mon, 18 Jul 2022 13:38:35 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     ChiYuan Huang <u0084500@...il.com>
Cc:     ChiaEn Wu <peterwu.pub@...il.com>,
        Lee Jones <lee.jones@...aro.org>,
        Daniel Thompson <daniel.thompson@...aro.org>,
        Jingoo Han <jingoohan1@...il.com>, Pavel Machek <pavel@....cz>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Matthias Brugger <matthias.bgg@...il.com>,
        Sebastian Reichel <sre@...nel.org>,
        Chunfeng Yun <chunfeng.yun@...iatek.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Jonathan Cameron <jic23@...nel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>,
        Guenter Roeck <linux@...ck-us.net>,
        "Krogerus, Heikki" <heikki.krogerus@...ux.intel.com>,
        Helge Deller <deller@....de>,
        ChiaEn Wu <chiaen_wu@...htek.com>,
        Alice Chen <alice_chen@...htek.com>,
        cy_huang <cy_huang@...htek.com>,
        dri-devel <dri-devel@...ts.freedesktop.org>,
        Linux LED Subsystem <linux-leds@...r.kernel.org>,
        devicetree <devicetree@...r.kernel.org>,
        linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
        "moderated list:ARM/Mediatek SoC support" 
        <linux-mediatek@...ts.infradead.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Linux PM <linux-pm@...r.kernel.org>,
        USB <linux-usb@...r.kernel.org>,
        linux-iio <linux-iio@...r.kernel.org>,
        "open list:FRAMEBUFFER LAYER" <linux-fbdev@...r.kernel.org>,
        szuni chen <szunichen@...il.com>
Subject: Re: [PATCH v5 08/13] usb: typec: tcpci_mt6370: Add MediaTek MT6370
 tcpci driver

On Mon, Jul 18, 2022 at 10:08 AM ChiYuan Huang <u0084500@...il.com> wrote:
> On Fri, Jul 15, 2022 at 03:10:42PM +0200, Andy Shevchenko wrote:
> > On Fri, Jul 15, 2022 at 1:28 PM ChiaEn Wu <peterwu.pub@...il.com> wrote:

...

> > > This commit add support for the Type-C & Power Delivery controller in
> >
> > This commit add -> Add
> >
> Upper case? Or rewrite it as 'This commit is to add .....'?

Please, read this documentation [1] for better understanding. It
should clarify this and perhaps other possible questions.

[1]: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes

> > > MediaTek MT6370 IC.

...

> > > +       ret = devm_request_threaded_irq(dev, priv->irq, NULL,
> > > +                                       mt6370_irq_handler, IRQF_ONESHOT,
> > > +                                       dev_name(dev), priv);
> > > +       if (ret) {
> >
> > > +               tcpci_unregister_port(priv->tcpci);
> >
> > This is wrong.
> > You mixed devm_ with non-devm. Either drop devm_ *after* the first
> > non-devm_ call, or convert everything to be managed.
> >
> How about to add 'devm_add_action_or_reset' for tcpci_unregister_port?
> This will convert all as 'devm_' version.

I think it would work, that wrapper was designed to cover cases like this.

> > > +               return dev_err_probe(dev, ret, "Failed to allocate irq\n");
> > > +       }

...

> > > +static int mt6370_tcpc_remove(struct platform_device *pdev)
> > > +{
> > > +       struct mt6370_priv *priv = platform_get_drvdata(pdev);
> >
> > > +       disable_irq(priv->irq);
> >
> > Why?
> > An ugly workaround due to ordering issues in ->probe()?
> >
> Yes, due to the ordering in probe.
> 'bus remove' will be called before device resource releases.
>
> Like as you said, another way is to convert all as non-devm
> version after 'tcpci_unregister_port'.
>
> If to keep the original order, 'disable_irq' before
> 'tcpci_unregister_port' can make the flow more safe.
>
> Or you can think one case if irq triggers after
> 'tcpci_unregister_port'. Null pointer occurs.
>
> Anyway, in next revision, I'll convert all to be 'devm_' version.
> For this remove callback, only 'dev_pm_clear_wake_irq' and
> 'device_init_wakeup' will be kept.
>
> Is this better?

Sounds like a plan!

> > > +       tcpci_unregister_port(priv->tcpci);
> > > +       dev_pm_clear_wake_irq(&pdev->dev);
> > > +       device_init_wakeup(&pdev->dev, false);
> > > +
> > > +       return 0;
> > > +}

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ