Skip to contentSkip to conversation

acpi-hmat-release-platform-device-in-case-of-platform_device_add_data-fails.patch removed from -mm tree

merged Andrew Morton 1 participant 1 message Oct 18, 2022

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: ACPI: HMAT: release platform device in case of platform_device_add_data() failure
has been removed from the -mm tree. Its filename was
acpi-hmat-release-platform-device-in-case-of-platform_device_add_data-fails.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Lin Yujun <[email protected]>
Subject: ACPI: HMAT: release platform device in case of platform_device_add_data() failure
Date: Wed, 14 Sep 2022 11:37:55 +0800

The platform device is not released when platform_device_add_data() fails. And platform_device_put() performs one more pointer check than put_device() to check for errors in the 'pdev' pointer.

Use platform_device_put() to release platform device in platform_device_add()/platform_device_add_data()/ platform_device_add_resources() error case.

Fixes c01044cc8191 ("ACPI: HMAT: refactor hmat_register_target_device to hmem_register_device")
Cc Dan Williams <[email protected]>
Cc Dave Jiang <[email protected]>
Cc Joao Martins <[email protected]>
Cc Vishal Verma <[email protected]>

---

 drivers/dax/hmem/device.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dax/hmem/device.c renamed from drivers/dax/hmem/device.c~acpi-hmat-release-platform-device-in-case-of-platform_device_add_data-fails +2 -2
@@ -47,7 +47,7 @@ void hmem_register_device(int target_nid
 	rc = platform_device_add_data(pdev, &info, sizeof(info));
 	if (rc < 0) {
 		pr_err("hmem memregion_info allocation failure for %pr\n", &res);
-		goto out_pdev;
+		goto out_resource;
 	}
 
 	rc = platform_device_add_resources(pdev, &res, 1);
@@ -65,7 +65,7 @@ void hmem_register_device(int target_nid
 	return;
 
 out_resource:
-	put_device(&pdev->dev);
+	platform_device_put(pdev);
 out_pdev:
 	memregion_free(id);
 }

_

Patches currently in -mm which might be from [email protected] are