diff options
author | Srinivas Kandagatla <srinivas.kandagatla@linaro.org> | 2018-08-07 15:19:35 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-11-20 20:46:31 +0300 |
commit | 88e9f8198dd5039868519f88e9bf78839643775c (patch) | |
tree | d6490d63635bdbb20169b4fb766d5af6935c96dc /drivers | |
parent | b0d54e40f3c44f43862e3f0952b3b0bf0984e014 (diff) | |
download | linux-88e9f8198dd5039868519f88e9bf78839643775c.tar.xz |
nvmem: core: return error code instead of NULL from nvmem_device_get
[ Upstream commit ca6ac25cecf0e740d7cc8e03e0ebbf8acbeca3df ]
nvmem_device_get() should return ERR_PTR() on error or valid pointer
on success, but one of the code path seems to return NULL, so fix it.
Reported-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/nvmem/core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index d32eba11c000..30c040786fde 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -692,7 +692,7 @@ static struct nvmem_device *nvmem_find(const char *name) d = bus_find_device_by_name(&nvmem_bus_type, NULL, name); if (!d) - return NULL; + return ERR_PTR(-ENOENT); return to_nvmem_device(d); } |