]> 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>
Wed, 22 Feb 2023 11:50:28 +0000 (12:50 +0100)
commitabe72b3bd89ca38e231617025e088d5cb889c8c3
tree47e8fb86607cea73e99fb3d30170369e9c421f6a
parentb3970e4bb9d7a0068e17c8f68d8743bb901ac7ec
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: c96bd26593b3d ("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