From: Srinivas Kandagatla Date: Tue, 7 Aug 2018 12:19:35 +0000 (+0100) Subject: nvmem: core: return error code instead of NULL from nvmem_device_get X-Git-Tag: v4.9.203~162 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1bf24e95f6b11b1b4bcf622ab92de43fe66aa310;p=platform%2Fkernel%2Flinux-amlogic.git 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 Signed-off-by: Srinivas Kandagatla Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 9ca24e4d5d49..2a0c5f3b0e50 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -609,7 +609,7 @@ static struct nvmem_device *nvmem_find(const char *name) d = bus_find_device(&nvmem_bus_type, NULL, (void *)name, nvmem_match); if (!d) - return NULL; + return ERR_PTR(-ENOENT); return to_nvmem_device(d); }