acpi/nfit: remove duplicate set nd_set in acpi_nfit_init_interleave_set()
diff mbox series

Message ID 20190114021929.3658-1-richardw.yang@linux.intel.com
State Superseded
Headers show
Series
  • acpi/nfit: remove duplicate set nd_set in acpi_nfit_init_interleave_set()
Related show

Commit Message

Wei Yang Jan. 14, 2019, 2:19 a.m. UTC
We allocate nd_set in acpi_nfit_init_interleave_set() and assignn it to
ndr_desc, while the assignment is done twice in this function.

This patch removes the second assignment. No functional change.

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
---
 drivers/acpi/nfit/core.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Dan Williams Jan. 14, 2019, 4:41 a.m. UTC | #1
On Sun, Jan 13, 2019 at 6:19 PM Wei Yang <richardw.yang@linux.intel.com> wrote:
>
> We allocate nd_set in acpi_nfit_init_interleave_set() and assignn it to
> ndr_desc, while the assignment is done twice in this function.
>
> This patch removes the second assignment. No functional change.

I think it makes more sense to remove the first assignment. Don't let
an uninitialized nd_set escape that routine. Either ->nd_set is left
NULL or it points to an initialized instance instead of potentially a
zeroed one.
Wei Yang Jan. 15, 2019, 3:04 a.m. UTC | #2
On Sun, Jan 13, 2019 at 08:41:11PM -0800, Dan Williams wrote:
>On Sun, Jan 13, 2019 at 6:19 PM Wei Yang <richardw.yang@linux.intel.com> wrote:
>>
>> We allocate nd_set in acpi_nfit_init_interleave_set() and assignn it to
>> ndr_desc, while the assignment is done twice in this function.
>>
>> This patch removes the second assignment. No functional change.
>
>I think it makes more sense to remove the first assignment. Don't let
>an uninitialized nd_set escape that routine. Either ->nd_set is left
>NULL or it points to an initialized instance instead of potentially a
>zeroed one.

Agree, I should be more careful.

Patch
diff mbox series

diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index 5912d30020c7..7b66d701d8ac 100644
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -2260,7 +2260,6 @@  static int acpi_nfit_init_interleave_set(struct acpi_nfit_desc *acpi_desc,
 		}
 	}
 
-	ndr_desc->nd_set = nd_set;
 	devm_kfree(dev, info);
 	devm_kfree(dev, info2);