]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
nvmem: core: add error handling for dev_set_name
authorGaosheng Cui <cuigaosheng1@huawei.com>
Fri, 16 Sep 2022 12:20:50 +0000 (13:20 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Feb 2023 11:55:54 +0000 (12:55 +0100)
commita19a0f67dbb89ad2bfc466f2003841acba645884
treeddef82a757108f599b901a4cd403c2833c93da1b
parent25f65c83f5f7c5de3d7c7f0b10e15a7413dfe5bf
nvmem: core: add error handling for dev_set_name

[ Upstream commit 5544e90c81261e82e02bbf7c6015a4b9c8c825ef ]

The type of return value of dev_set_name is int, which may return
wrong result, so we add error handling for it to reclaim memory
of nvmem resource, and return early when an error occurs.

Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122100.170016-4-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stable-dep-of: ab3428cfd9aa ("nvmem: core: fix registration vs use race")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvmem/core.c