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]
Date:   Sat, 8 Jan 2022 13:29:05 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     "Gabriel L. Somlo" <gsomlo@...il.com>
Cc:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "robh+dt@...nel.org" <robh+dt@...nel.org>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        "ulf.hansson@...aro.org" <ulf.hansson@...aro.org>,
        "linux-mmc@...r.kernel.org" <linux-mmc@...r.kernel.org>,
        "kgugala@...micro.com" <kgugala@...micro.com>,
        "mholenko@...micro.com" <mholenko@...micro.com>,
        "krakoczy@...micro.com" <krakoczy@...micro.com>,
        "mdudek@...ernships.antmicro.com" <mdudek@...ernships.antmicro.com>,
        "paulus@...abs.org" <paulus@...abs.org>,
        "joel@....id.au" <joel@....id.au>,
        "shorne@...il.com" <shorne@...il.com>,
        "geert@...ux-m68k.org" <geert@...ux-m68k.org>,
        "david.abdurachmanov@...ive.com" <david.abdurachmanov@...ive.com>,
        "florent@...oy-digital.fr" <florent@...oy-digital.fr>,
        "rdunlap@...radead.org" <rdunlap@...radead.org>
Subject: Re: [PATCH v8 3/3] mmc: Add driver for LiteX's LiteSDCard interface

On Sat, Jan 8, 2022 at 4:32 AM Gabriel L. Somlo <gsomlo@...il.com> wrote:
> On Fri, Jan 07, 2022 at 08:57:43PM -0500, Gabriel L. Somlo wrote:
> > On Sat, Jan 08, 2022 at 01:54:07AM +0200, Andy Shevchenko wrote:
> > > On Saturday, January 8, 2022, Gabriel Somlo <gsomlo@...il.com> wrote:

...

> > >     +       mmc = mmc_alloc_host(sizeof(struct litex_mmc_host), &pdev->dev);
> > >
> > > Should be devm or you may not use devm at all. See hint in one of the previous
> > > messages in v7 discussion.
> >
> > And here I think I'm in trouble... :)
> >
> > None of the examples retrieved via
> >
> > `git log --no-merges --grep devm_add_action_or_reset`
> >
> > are from "drivers/mmc/host/*", and *all* of the mmc drivers there,
> > including the ones that make extensive use of devm_*, use
> > mmc_alloc_host(), and there doesn't appear to be a devm-ified version
> > of mmc_alloc_host() available! How do they all get away with it?
> >
> > I'm really confused now -- any additional clue(s) much appreciated!
>
> I found drivers/mmc/host/meson-mx-sdhc-mmc.c, which uses
> devm_add_action_or_reset() right after mmc_alloc_host() to enlist the
> subsequent call to mmc_free_host(), see here:
>
> https://github.com/torvalds/linux/blob/master/drivers/mmc/host/meson-mx-sdhc-mmc.c#L791
>
> This would mean that I no longer have to call mmc_free_host(), neither
> on probe()'s error path, nor during remove().
>
> Does that count as canonically correct, or am I still missing
> something?

Yes, this is one of the options you may use.

Since it will be a second (?) driver with the same idea, perhaps in
the future it would make sense to provide devm_mmc_alloc_host() or
analogue (in the latter it means more complex solution like the input
subsystem is using, see devm_input_... API implementations).

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ