summaryrefslogtreecommitdiff
path: root/drivers/nvmem/core.c
diff options
context:
space:
mode:
authorSrinivas Kandagatla <srinivas.kandagatla@linaro.org>2018-08-07 13:19:35 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-12 09:46:46 +0200
commitca6ac25cecf0e740d7cc8e03e0ebbf8acbeca3df (patch)
treee1c7b6bd2b493ac5c7833bbb92695d2b2af8d06b /drivers/nvmem/core.c
parent0181cfd93c7b09a3fc69ff734e84c49bfe7d9020 (diff)
nvmem: core: return error code instead of NULL from nvmem_device_get
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>
Diffstat (limited to 'drivers/nvmem/core.c')
-rw-r--r--drivers/nvmem/core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index aa1657831b70..6f064002f439 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -679,7 +679,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);
}