From: Ira Weiny <ira.weiny@intel.com>
To: Li Zhijian <lizhijian@fujitsu.com>, <nvdimm@lists.linux.dev>
Cc: <dan.j.williams@intel.com>, <vishal.l.verma@intel.com>,
<dave.jiang@intel.com>, <ira.weiny@intel.com>,
<linux-kernel@vger.kernel.org>,
Li Zhijian <lizhijian@fujitsu.com>
Subject: Re: [PATCH v3 2/2] nvdimm: Remove dead code for ENODEV checking in scan_labels()
Date: Wed, 21 Aug 2024 14:00:53 -0500 [thread overview]
Message-ID: <66c6396577ab9_1719d2945@iweiny-mobl.notmuch> (raw)
In-Reply-To: <20240819062045.1481298-2-lizhijian@fujitsu.com>
Li Zhijian wrote:
> The only way create_namespace_pmem() returns an ENODEV code is if
> select_pmem_id(nd_region, &uuid) returns ENODEV when its 2nd parameter
> is a null pointer. However, this is impossible because &uuid is always
> valid.
>
> Furthermore, create_namespace_pmem() is the only user of
> select_pmem_id(), it's safe to remove the 'return -ENODEV' branch.
>
> Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
> ---
> V2:
> new patch.
> It's found when I'm Reviewing/tracing the return values of create_namespace_pmem()
> ---
> drivers/nvdimm/namespace_devs.c | 9 ---------
> 1 file changed, 9 deletions(-)
>
> diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c
> index 35d9f3cc2efa..55cfbf1e0a95 100644
> --- a/drivers/nvdimm/namespace_devs.c
> +++ b/drivers/nvdimm/namespace_devs.c
> @@ -1612,9 +1612,6 @@ static int select_pmem_id(struct nd_region *nd_region, const uuid_t *pmem_id)
> {
> int i;
>
> - if (!pmem_id)
> - return -ENODEV;
> -
> for (i = 0; i < nd_region->ndr_mappings; i++) {
> struct nd_mapping *nd_mapping = &nd_region->mapping[i];
> struct nvdimm_drvdata *ndd = to_ndd(nd_mapping);
> @@ -1790,9 +1787,6 @@ static struct device *create_namespace_pmem(struct nd_region *nd_region,
> case -EINVAL:
> dev_dbg(&nd_region->dev, "invalid label(s)\n");
> break;
> - case -ENODEV:
> - dev_dbg(&nd_region->dev, "label not found\n");
> - break;
> default:
> dev_dbg(&nd_region->dev, "unexpected err: %d\n", rc);
> break;
> @@ -1980,9 +1974,6 @@ static struct device **scan_labels(struct nd_region *nd_region)
> case -EAGAIN:
> /* skip invalid labels */
> continue;
> - case -ENODEV:
> - /* fallthrough to seed creation */
> - break;
> default:
> goto err;
> }
> --
> 2.29.2
>
next prev parent reply other threads:[~2024-08-21 19:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-19 6:20 [PATCH v3 1/2] nvdimm: Fix devs leaks " Li Zhijian
2024-08-19 6:20 ` [PATCH v3 2/2] nvdimm: Remove dead code for ENODEV checking " Li Zhijian
2024-08-21 19:00 ` Ira Weiny [this message]
2024-08-21 19:00 ` [PATCH v3 1/2] nvdimm: Fix devs leaks " Ira Weiny
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=66c6396577ab9_1719d2945@iweiny-mobl.notmuch \
--to=ira.weiny@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizhijian@fujitsu.com \
--cc=nvdimm@lists.linux.dev \
--cc=vishal.l.verma@intel.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
all inboxes | Powered by JetHome®