4.9-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Dan Williams <[email protected]>

commit 8d0d8ed3356aa9ed43b819aaedd39b08ca453007 upstream.

Commit 1cf03c00e7c1 "nfit: scrub and register regions in a workqueue"
mistakenly attempts to register a region per BLK aperture. There is
nothing to register for individual apertures as they belong as a set to
a BLK aperture group that are registered with a corresponding
DIMM-control-region. Filter them for registration to prevent some
needless devm_kzalloc() allocations.

Cc: <[email protected]>
Fixes: 1cf03c00e7c1 ("nfit: scrub and register regions in a workqueue")
Reviewed-by: Dave Jiang <[email protected]>
Signed-off-by: Dan Williams <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/acpi/nfit/core.c |   22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -2547,15 +2547,21 @@ static void acpi_nfit_scrub(struct work_
 static int acpi_nfit_register_regions(struct acpi_nfit_desc *acpi_desc)
 {
        struct nfit_spa *nfit_spa;
-       int rc;
 
-       list_for_each_entry(nfit_spa, &acpi_desc->spas, list)
-               if (nfit_spa_type(nfit_spa->spa) == NFIT_SPA_DCR) {
-                       /* BLK regions don't need to wait for ars results */
-                       rc = acpi_nfit_register_region(acpi_desc, nfit_spa);
-                       if (rc)
-                               return rc;
-               }
+       list_for_each_entry(nfit_spa, &acpi_desc->spas, list) {
+               int rc, type = nfit_spa_type(nfit_spa->spa);
+
+               /* PMEM and VMEM will be registered by the ARS workqueue */
+               if (type == NFIT_SPA_PM || type == NFIT_SPA_VOLATILE)
+                       continue;
+               /* BLK apertures belong to BLK region registration below */
+               if (type == NFIT_SPA_BDW)
+                       continue;
+               /* BLK regions don't need to wait for ARS results */
+               rc = acpi_nfit_register_region(acpi_desc, nfit_spa);
+               if (rc)
+                       return rc;
+       }
 
        queue_work(nfit_wq, &acpi_desc->work);
        return 0;


Reply via email to