nvmem: core: return error code instead of NULL from nvmem_device_get

[ Upstream commit ca6ac25cec ]

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>
This commit is contained in:
Srinivas Kandagatla 2018-08-07 13:19:35 +01:00 committed by Greg Kroah-Hartman
parent 57441e0615
commit 3801e9dd95

View file

@ -617,7 +617,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);
}