[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <690d4178c4d4_29fa161007f@iweiny-mobl.notmuch>
Date: Thu, 6 Nov 2025 18:46:48 -0600
From: Ira Weiny <ira.weiny@...el.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>, Ira Weiny
<ira.weiny@...el.com>, <nvdimm@...ts.linux.dev>,
<linux-kernel@...r.kernel.org>
CC: Dan Williams <dan.j.williams@...el.com>, Vishal Verma
<vishal.l.verma@...el.com>, Dave Jiang <dave.jiang@...el.com>
Subject: Re: [PATCH v1 1/1] libnvdimm/labels: Get rid of redundant 'else'
Andy Shevchenko wrote:
> In the snippets like the following
>
> if (...)
> return / goto / break / continue ...;
> else
> ...
>
> the 'else' is redundant. Get rid of it.
>
I still need a why to in this commit message.
[snip]
> @@ -768,20 +768,20 @@ static const guid_t *to_abstraction_guid(enum nvdimm_claim_class claim_class,
> {
> if (claim_class == NVDIMM_CCLASS_BTT)
> return &nvdimm_btt_guid;
> - else if (claim_class == NVDIMM_CCLASS_BTT2)
> + if (claim_class == NVDIMM_CCLASS_BTT2)
> return &nvdimm_btt2_guid;
> - else if (claim_class == NVDIMM_CCLASS_PFN)
> + if (claim_class == NVDIMM_CCLASS_PFN)
> return &nvdimm_pfn_guid;
> - else if (claim_class == NVDIMM_CCLASS_DAX)
> + if (claim_class == NVDIMM_CCLASS_DAX)
> return &nvdimm_dax_guid;
> - else if (claim_class == NVDIMM_CCLASS_UNKNOWN) {
> - /*
> - * If we're modifying a namespace for which we don't
> - * know the claim_class, don't touch the existing guid.
> - */
> - return target;
> - } else
> + if (claim_class == NVDIMM_CCLASS_NONE)
> return &guid_null;
> +
> + /*
> + * If we're modifying a namespace for which we don't
> + * know the claim_class, don't touch the existing guid.
> + */
> + return target;
This is not an equivalent change.
> }
>
> /* CXL labels store UUIDs instead of GUIDs for the same data */
> @@ -790,20 +790,20 @@ static const uuid_t *to_abstraction_uuid(enum nvdimm_claim_class claim_class,
> {
> if (claim_class == NVDIMM_CCLASS_BTT)
> return &nvdimm_btt_uuid;
> - else if (claim_class == NVDIMM_CCLASS_BTT2)
> + if (claim_class == NVDIMM_CCLASS_BTT2)
> return &nvdimm_btt2_uuid;
> - else if (claim_class == NVDIMM_CCLASS_PFN)
> + if (claim_class == NVDIMM_CCLASS_PFN)
> return &nvdimm_pfn_uuid;
> - else if (claim_class == NVDIMM_CCLASS_DAX)
> + if (claim_class == NVDIMM_CCLASS_DAX)
> return &nvdimm_dax_uuid;
> - else if (claim_class == NVDIMM_CCLASS_UNKNOWN) {
> - /*
> - * If we're modifying a namespace for which we don't
> - * know the claim_class, don't touch the existing uuid.
> - */
> - return target;
> - } else
> + if (claim_class == NVDIMM_CCLASS_NONE)
> return &uuid_null;
> +
> + /*
> + * If we're modifying a namespace for which we don't
> + * know the claim_class, don't touch the existing uuid.
> + */
> + return target;
This is not an equivalent change.
Ira
[snip]
Powered by blists - more mailing lists