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:57:03 +0000 (12:57 +0100)
commit14eea6449473c1f55e196cc104ba16d144465869
tree3223b36f5b53cbcf6d11b4c1e433febe563f435a
parent36a5ae5cf90ae2398cb265acd4cd364de9327999
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