summaryrefslogtreecommitdiff
path: root/drivers/nvmem/core.c
diff options
context:
space:
mode:
authorKhouloud Touil <ktouil@baylibre.com>2020-03-10 13:22:50 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-03-19 07:41:03 +0100
commita9c3766cb19cdadf2776aba41b64470002645894 (patch)
treebc61d3afcf5e16f676fe28ce006cbd93cb19c9ae /drivers/nvmem/core.c
parentf7d8d7dcd978382dd1dd36e240dcddbfa6697796 (diff)
downloadlwn-a9c3766cb19cdadf2776aba41b64470002645894.tar.gz
lwn-a9c3766cb19cdadf2776aba41b64470002645894.zip
nvmem: release the write-protect pin
Put the write-protect GPIO descriptor in nvmem_release() so that it can be automatically released when the associated device's reference count drops to 0. Fixes: 2a127da461a9 ("nvmem: add support for the write-protect pin") Reported-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Khouloud Touil <ktouil@baylibre.com> Cc: stable <stable@vger.kernel.org> [Bartosz: tweak the commit message] Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20200310132257.23358-8-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/nvmem/core.c')
-rw-r--r--drivers/nvmem/core.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 2758d90d63b7..c05c4f4a7b9e 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -72,6 +72,7 @@ static void nvmem_release(struct device *dev)
struct nvmem_device *nvmem = to_nvmem_device(dev);
ida_simple_remove(&nvmem_ida, nvmem->id);
+ gpiod_put(nvmem->wp_gpio);
kfree(nvmem);
}