From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Miquel Raynal <miquel.raynal@bootlin.com>, linux-kernel@vger.kernel.org
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Michael Walle" <michael@walle.cc>,
"Rafał Miłecki" <rafal@milecki.pl>,
"Robert Marko" <robert.marko@sartura.hr>,
"Luka Perkov" <luka.perkov@sartura.hr>,
"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
"Rob Herring" <robh+dt@kernel.org>,
"Frank Rowand" <frowand.list@gmail.com>,
devicetree@vger.kernel.org,
"Alexander Stein" <alexander.stein@ew.tq-group.com>
Subject: Re: [PATCH v2 09/21] nvmem: core: return -ENOENT if nvmem cell is not found
Date: Fri, 10 Mar 2023 09:57:54 +0000 [thread overview]
Message-ID: <6244680f-44db-0706-eada-dffdb05f116a@linaro.org> (raw)
In-Reply-To: <20230307165359.225361-10-miquel.raynal@bootlin.com>
On 07/03/2023 16:53, Miquel Raynal wrote:
> From: Michael Walle <michael@walle.cc>
>
> 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@ew.tq-group.com>
> Signed-off-by: Michael Walle <michael@walle.cc>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
Already applied.
--srini
> drivers/nvmem/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> index 174ef3574e07..22024b830788 100644
> --- a/drivers/nvmem/core.c
> +++ b/drivers/nvmem/core.c
> @@ -1231,7 +1231,7 @@ struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, const char *id)
> "#nvmem-cell-cells",
> index, &cell_spec);
> if (ret)
> - return ERR_PTR(ret);
> + return ERR_PTR(-ENOENT);
>
> if (cell_spec.args_count > 1)
> return ERR_PTR(-EINVAL);
next prev parent reply other threads:[~2023-03-10 9:58 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-07 16:53 [PATCH v2 00/21] nvmem: Layouts support Miquel Raynal
2023-03-07 16:53 ` [PATCH v2 01/21] of: Fix modalias string generation Miquel Raynal
2023-03-07 16:53 ` [PATCH v2 02/21] of: Update of_device_get_modalias() Miquel Raynal
2023-03-08 0:28 ` Rob Herring
2023-03-07 16:53 ` [PATCH v2 03/21] of: Rename of_modalias_node() Miquel Raynal
2023-03-08 0:19 ` Rob Herring
2023-03-08 14:17 ` Miquel Raynal
2023-03-08 22:06 ` Sebastian Reichel
2023-03-09 13:28 ` Rob Herring
2023-03-07 16:53 ` [PATCH v2 04/21] of: Move of_modalias() to module.c Miquel Raynal
2023-03-08 0:23 ` Rob Herring
2023-03-08 14:51 ` Miquel Raynal
2023-03-07 16:53 ` [PATCH v2 05/21] of: Move the request module helper logic " Miquel Raynal
2023-03-08 0:25 ` Rob Herring
2023-03-07 16:53 ` [PATCH v2 06/21] usb: ulpi: Use of_request_module() Miquel Raynal
2023-03-08 0:25 ` Rob Herring
2023-03-07 16:53 ` [PATCH v2 07/21] of: device: Kill of_device_request_module() Miquel Raynal
2023-03-08 0:26 ` Rob Herring
2023-03-07 16:53 ` [PATCH v2 08/21] dt-bindings: nvmem: Fix spelling mistake "platforn" -> "platform" Miquel Raynal
2023-03-08 0:08 ` Rob Herring
2023-03-08 14:07 ` Miquel Raynal
2023-03-10 9:55 ` Srinivas Kandagatla
2023-03-07 16:53 ` [PATCH v2 09/21] nvmem: core: return -ENOENT if nvmem cell is not found Miquel Raynal
2023-03-07 17:04 ` Michael Walle
2023-03-10 9:57 ` Srinivas Kandagatla [this message]
2023-03-10 10:00 ` Miquel Raynal
2023-03-07 16:53 ` [PATCH v2 10/21] nvmem: core: introduce NVMEM layouts Miquel Raynal
2023-03-07 16:53 ` [PATCH v2 11/21] nvmem: core: handle the absence of expected layouts Miquel Raynal
2023-03-10 10:30 ` Srinivas Kandagatla
2023-03-10 10:45 ` Miquel Raynal
2023-03-10 10:49 ` Srinivas Kandagatla
2023-03-07 16:53 ` [PATCH v2 12/21] nvmem: core: request layout modules loading Miquel Raynal
2023-03-07 16:53 ` [PATCH v2 13/21] nvmem: core: add per-cell post processing Miquel Raynal
2023-03-07 16:53 ` [PATCH v2 14/21] nvmem: core: allow to modify a cell before adding it Miquel Raynal
2023-03-07 16:53 ` [PATCH v2 15/21] nvmem: imx-ocotp: replace global post processing with layouts Miquel Raynal
2023-03-07 16:53 ` [PATCH v2 16/21] nvmem: cell: drop global cell_post_process Miquel Raynal
2023-03-07 16:53 ` [PATCH v2 17/21] nvmem: core: provide own priv pointer in post process callback Miquel Raynal
2023-03-07 16:53 ` [PATCH v2 18/21] nvmem: layouts: sl28vpd: Add new layout driver Miquel Raynal
2023-03-07 16:53 ` [PATCH v2 19/21] MAINTAINERS: add myself as sl28vpd nvmem " Miquel Raynal
2023-03-07 16:53 ` [PATCH v2 20/21] nvmem: layouts: onie-tlv: Add new " Miquel Raynal
2023-03-07 16:53 ` [PATCH v2 21/21] MAINTAINERS: Add myself as ONIE tlv NVMEM layout maintainer Miquel Raynal
2023-03-07 17:09 ` [PATCH v2 00/21] nvmem: Layouts support Miquel Raynal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6244680f-44db-0706-eada-dffdb05f116a@linaro.org \
--to=srinivas.kandagatla@linaro.org \
--cc=alexander.stein@ew.tq-group.com \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luka.perkov@sartura.hr \
--cc=michael@walle.cc \
--cc=miquel.raynal@bootlin.com \
--cc=rafal@milecki.pl \
--cc=robert.marko@sartura.hr \
--cc=robh+dt@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).