From: Michael Walle <michael@xxxxxxxx>
Prior to commit 3cb05fdbaed6 ("nvmem: core: add an index parameter to
the cell") of_nvmem_cell_get() would return -ENOENT if the cell wasn't
found. Particularly, if of_property_match_string() returned -EINVAL,
that return code was passed as the index to of_parse_phandle(), which
then detected it as invalid and returned NULL. That led to an return
code of -ENOENT.
With the new code, the negative index will lead to an -EINVAL of
of_parse_phandle_with_optional_args() which pass straight to the
caller and break those who expect an -ENOENT.
Fix it by always returning -ENOENT.
Fixes: efff2655ab0f ("nvmem: core: add an index parameter to the cell")
Reported-by: Alexander Stein <alexander.stein@xxxxxxxxxxxxxxx>
Signed-off-by: Michael Walle <michael@xxxxxxxx>
Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>