[PATCH v2 04/11] nvmem: release write protection when the provider disconnects

sashiko-bot at kernel.org sashiko-bot at kernel.org
Thu Nov 19 08:52:33 PST 2026


Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] nvmem: inaccurate Fixes trailer in commit message for wp_gpio
  release
--

commit 02c6a5d986a679decc94c88b75af03c4912c7f6d
Author: James Hilliard <james.hilliard1 at gmail.com>

> nvmem: release write protection when the provider disconnects
>
> Retained NVMEM consumers keep the device allocation alive after unregister.
> Keeping the write-protect GPIO until final device release prevents a
> replacement provider from requesting the same GPIO.
>
> Release it after draining provider callbacks, when no write can still
> use it. Do this for registration failures as well as unregister.
>
> Fixes: 2a127da461a9 ("nvmem: add support for the write-protect pin")
> Signed-off-by: James Hilliard <james.hilliard1 at gmail.com>

[Severity: Low]
Does the Fixes tag point to the commit that actually caused wp_gpio to
remain acquired across nvmem_unregister()?

Commit 2a127da461a9 ("nvmem: add support for the write-protect pin") did
not release wp_gpio at all; commit a9c3766cb19c ("nvmem: release the
write-protect pin") later added gpiod_put(nvmem->wp_gpio) to
nvmem_release().  At that point nvmem_unregister() only dropped
nvmem->refcnt, so device unregistration waited for all consumers.  It was
commit 87341c4dd5de ("nvmem: remove duplicated reference counting") and
commit 6a7b4134fb7a ("nvmem: protect nvmem_device::ops with SRCU") that
changed nvmem_unregister() to immediately unregister and disconnect the
provider while leaving gpiod_put(nvmem->wp_gpio) in nvmem_release().

Should this instead use:

  Fixes: 6a7b4134fb7a ("nvmem: protect nvmem_device::ops with SRCU")

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261119-submit-nvmem-provider-lifetime-v1-v2-0-8fca3ec5f18c@gmail.com?part=4



More information about the linux-mtd mailing list