Commit ca6ac25c authored by Srinivas Kandagatla's avatar Srinivas Kandagatla Committed by Greg Kroah-Hartman

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: default avatarNiklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0181cfd9
...@@ -679,7 +679,7 @@ static struct nvmem_device *nvmem_find(const char *name) ...@@ -679,7 +679,7 @@ static struct nvmem_device *nvmem_find(const char *name)
d = bus_find_device_by_name(&nvmem_bus_type, NULL, name); d = bus_find_device_by_name(&nvmem_bus_type, NULL, name);
if (!d) if (!d)
return NULL; return ERR_PTR(-ENOENT);
return to_nvmem_device(d); return to_nvmem_device(d);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment