diff options
| author | Dan Williams <dan.j.williams@intel.com> | 2016-07-21 21:05:36 -0400 |
|---|---|---|
| committer | Dan Williams <dan.j.williams@intel.com> | 2016-07-22 16:35:54 -0400 |
| commit | 58cd71b4747432b0ef3b86db1b09c12e6c97204b (patch) | |
| tree | a99518d92af22a31392b19a5972c4622a3a7eaf0 /tools/testing/nvdimm/test | |
| parent | bc9775d8697f57b333b6b316fb5145d6ca9dc36d (diff) | |
nfit, tools/testing/nvdimm/: unify shutdown paths
While testing the new on-demand ARS patches we discovered that
differences between the nfit_test and normal nfit driver shutdown paths
can leak resources. Unify the shutdown paths to trigger via a devm_
callback when the acpi_desc->dev is unbound from its driver.
Reviewed-by: Lee, Chun-Yi <jlee@suse.com>
Reported-by: Vishal Verma <vishal.l.verma@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'tools/testing/nvdimm/test')
| -rw-r--r-- | tools/testing/nvdimm/test/nfit.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c index 642713f15723..5404efa578a3 100644 --- a/tools/testing/nvdimm/test/nfit.c +++ b/tools/testing/nvdimm/test/nfit.c | |||
| @@ -1465,16 +1465,11 @@ static int nfit_test_probe(struct platform_device *pdev) | |||
| 1465 | nd_desc->provider_name = NULL; | 1465 | nd_desc->provider_name = NULL; |
| 1466 | nd_desc->module = THIS_MODULE; | 1466 | nd_desc->module = THIS_MODULE; |
| 1467 | nd_desc->ndctl = nfit_test_ctl; | 1467 | nd_desc->ndctl = nfit_test_ctl; |
| 1468 | acpi_desc->nvdimm_bus = nvdimm_bus_register(&pdev->dev, nd_desc); | ||
| 1469 | if (!acpi_desc->nvdimm_bus) | ||
| 1470 | return -ENXIO; | ||
| 1471 | 1468 | ||
| 1472 | rc = acpi_nfit_init(acpi_desc, nfit_test->nfit_buf, | 1469 | rc = acpi_nfit_init(acpi_desc, nfit_test->nfit_buf, |
| 1473 | nfit_test->nfit_size); | 1470 | nfit_test->nfit_size); |
| 1474 | if (rc) { | 1471 | if (rc) |
| 1475 | nvdimm_bus_unregister(acpi_desc->nvdimm_bus); | ||
| 1476 | return rc; | 1472 | return rc; |
| 1477 | } | ||
| 1478 | 1473 | ||
| 1479 | if (nfit_test->setup != nfit_test0_setup) | 1474 | if (nfit_test->setup != nfit_test0_setup) |
| 1480 | return 0; | 1475 | return 0; |
| @@ -1484,21 +1479,14 @@ static int nfit_test_probe(struct platform_device *pdev) | |||
| 1484 | 1479 | ||
| 1485 | rc = acpi_nfit_init(acpi_desc, nfit_test->nfit_buf, | 1480 | rc = acpi_nfit_init(acpi_desc, nfit_test->nfit_buf, |
| 1486 | nfit_test->nfit_size); | 1481 | nfit_test->nfit_size); |
| 1487 | if (rc) { | 1482 | if (rc) |
| 1488 | nvdimm_bus_unregister(acpi_desc->nvdimm_bus); | ||
| 1489 | return rc; | 1483 | return rc; |
| 1490 | } | ||
| 1491 | 1484 | ||
| 1492 | return 0; | 1485 | return 0; |
| 1493 | } | 1486 | } |
| 1494 | 1487 | ||
| 1495 | static int nfit_test_remove(struct platform_device *pdev) | 1488 | static int nfit_test_remove(struct platform_device *pdev) |
| 1496 | { | 1489 | { |
| 1497 | struct nfit_test *nfit_test = to_nfit_test(&pdev->dev); | ||
| 1498 | struct acpi_nfit_desc *acpi_desc = &nfit_test->acpi_desc; | ||
| 1499 | |||
| 1500 | nvdimm_bus_unregister(acpi_desc->nvdimm_bus); | ||
| 1501 | |||
| 1502 | return 0; | 1490 | return 0; |
| 1503 | } | 1491 | } |
| 1504 | 1492 | ||
