]> git.baikalelectronics.ru Git - kernel.git/commit
nvmem: core: fix cell removal on error
authorMichael Walle <michael@walle.cc>
Fri, 27 Jan 2023 10:40:13 +0000 (10:40 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Feb 2023 10:28:25 +0000 (11:28 +0100)
commit76cb940e57a184724b63d7862959c8aa8e07d64c
treefe6d3aa350ef1371fc82ac34a500a7799b5fc1cf
parentf31a3829d82cec69686ea9f06b9719f0b0ee15b3
nvmem: core: fix cell removal on error

commit db3546d58b5a0fa581d9c9f2bdc2856fa6c5e43e upstream.

nvmem_add_cells() could return an error after some cells are already
added to the provider. In this case, the added cells are not removed.
Remove any registered cells if nvmem_add_cells() fails.

Fixes: 800431f5fa423 ("nvmem: check the return value of nvmem_add_cells()")
Cc: stable@vger.kernel.org
Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230127104015.23839-9-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/nvmem/core.c