From 58cd71b4747432b0ef3b86db1b09c12e6c97204b Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 21 Jul 2016 18:05:36 -0700 Subject: 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 Reported-by: Vishal Verma Signed-off-by: Dan Williams --- tools/testing/nvdimm/test/nfit.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'tools/testing/nvdimm/test/nfit.c') 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) nd_desc->provider_name = NULL; nd_desc->module = THIS_MODULE; nd_desc->ndctl = nfit_test_ctl; - acpi_desc->nvdimm_bus = nvdimm_bus_register(&pdev->dev, nd_desc); - if (!acpi_desc->nvdimm_bus) - return -ENXIO; rc = acpi_nfit_init(acpi_desc, nfit_test->nfit_buf, nfit_test->nfit_size); - if (rc) { - nvdimm_bus_unregister(acpi_desc->nvdimm_bus); + if (rc) return rc; - } if (nfit_test->setup != nfit_test0_setup) return 0; @@ -1484,21 +1479,14 @@ static int nfit_test_probe(struct platform_device *pdev) rc = acpi_nfit_init(acpi_desc, nfit_test->nfit_buf, nfit_test->nfit_size); - if (rc) { - nvdimm_bus_unregister(acpi_desc->nvdimm_bus); + if (rc) return rc; - } return 0; } static int nfit_test_remove(struct platform_device *pdev) { - struct nfit_test *nfit_test = to_nfit_test(&pdev->dev); - struct acpi_nfit_desc *acpi_desc = &nfit_test->acpi_desc; - - nvdimm_bus_unregister(acpi_desc->nvdimm_bus); - return 0; } -- cgit v1.2.3-59-g8ed1b