Skip to contentSkip to conversation

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

PATCH Superseded Wei Yang 2 participants 5 messages Jan 14, 2019 – Jan 15, 2019

Subsystems (2)
lore
Share & tools
lore

Wei Yang

author
#0 lore raw

PATCH 1/1 acpi/nfit: remove duplicate set nd_set in acpi_nfit_init_interleave_set()

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.

---
 drivers/acpi/nfit/core.c | 1 -
 1 file changed, 1 deletion(-)
drivers/acpi/nfit/core.c +0 -1
index 5912d30020c7..7b66d701d8ac 100644
@@ -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);
 
Signature · 6 lines
2.19.1

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
#1 lore raw
Quoted 5 lines · Wei Yang

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.
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

author
#2 lore raw
Quoted 11 lines · Dan Williams
Quoted 5 lines · Wei Yang

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.

Signature · 6 lines
Wei Yang
Help you, Help me
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
author
#3 lore raw

PATCH v2 1/1 acpi/nfit: remove duplicate set nd_set in acpi_nfit_init_interleave_set()

In reply to Wei Yang

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 first assignment. No functional change.

---
v2:
* remove the first assignment to avoid some leak

---
 drivers/acpi/nfit/core.c | 1 -
 1 file changed, 1 deletion(-)
drivers/acpi/nfit/core.c +0 -1
index 5912d30020c7..9c3c2d2f37be 100644
@@ -2187,7 +2187,6 @@ static int acpi_nfit_init_interleave_set(struct acpi_nfit_desc *acpi_desc,
 	nd_set = devm_kzalloc(dev, sizeof(*nd_set), GFP_KERNEL);
 	if (!nd_set)
 		return -ENOMEM;
-	ndr_desc->nd_set = nd_set;
 	guid_copy(&nd_set->type_guid, (guid_t *) spa->range_guid);
 
 	info = devm_kzalloc(dev, sizeof_nfit_set_info(nr), GFP_KERNEL);
Signature · 6 lines
2.19.1

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
#4 lore raw
Quoted 11 lines · Wei Yang

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 first assignment. No functional change.

---
v2:
* remove the first assignment to avoid some leak

Looks good, applied.
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm