Skip to contentSkip to conversation

acpi/nfit: not set nfit_mem when it is found

PATCH New Wei Yang 1 participant 1 message Jan 16, 2019

Subsystems (2)
lore
Share & tools
lore

Wei Yang

author
#0 lore raw

PATCH 1/1 acpi/nfit: not set nfit_mem when it is found

In __nfit_mem_init(), one nfit_mem will be created in case we can't find one nfit_mem with matched device_handle. The variable *found* indicates this research result.

If we found one, variable *found* is set to non-NULL and variable *nfit_mem* already points to the data structure we want to set up. This is not necessary to reset variable *nfit_mem* to *found* again.

This patch removes the assignment of *nfit_mem* to *found* when they are the same.

---
 drivers/acpi/nfit/core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/acpi/nfit/core.c +1 -3
index 9c3c2d2f37be..4643aa10ed2a 100644
@@ -1053,9 +1053,7 @@ static int __nfit_mem_init(struct acpi_nfit_desc *acpi_desc,
 				break;
 			}
 
-		if (found)
-			nfit_mem = found;
-		else {
+		if (!found) {
 			nfit_mem = devm_kzalloc(acpi_desc->dev,
 					sizeof(*nfit_mem), GFP_KERNEL);
 			if (!nfit_mem)
Signature · 6 lines
2.19.1

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