nvmem: core: Fix of_nvmem_cell_get() for optional cells
authorAlban Bedel <albeu@free.fr>
Mon, 28 Jan 2019 15:55:01 +0000 (15:55 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 31 Jan 2019 15:24:14 +0000 (16:24 +0100)
of_nvmem_cell_get() should return -ENOENT when a cell isn't defined,
otherwise callers can't distinguish between a missing cell and other
errors.

Signed-off-by: Alban Bedel <albeu@free.fr>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/nvmem/core.c

index cf2e1091fe89fe86704de5bab2441003c379358f..f8c43da6f2ca7ce228930b6a5858cc36f099da4a 100644 (file)
@@ -1031,7 +1031,7 @@ struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, const char *id)
 
        cell_np = of_parse_phandle(np, "nvmem-cells", index);
        if (!cell_np)
-               return ERR_PTR(-EINVAL);
+               return ERR_PTR(-ENOENT);
 
        nvmem_np = of_get_next_parent(cell_np);
        if (!nvmem_np)