All of lore.kernel.org
 help / color / mirror / Atom feed
* + acpi-hmat-release-platform-device-in-case-of-platform_device_add_data-fails.patch added to mm-unstable branch
@ 2022-09-26 16:10 Andrew Morton
  0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2022-09-26 16:10 UTC (permalink / raw)
  To: mm-commits, vishal.l.verma, joao.m.martins, dave.jiang,
	dan.j.williams, linyujun809, akpm


The patch titled
     Subject: ACPI: HMAT: release platform device in case of platform_device_add_data() failure
has been added to the -mm mm-unstable branch.  Its filename is
     acpi-hmat-release-platform-device-in-case-of-platform_device_add_data-fails.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/acpi-hmat-release-platform-device-in-case-of-platform_device_add_data-fails.patch

This patch will later appear in the mm-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days

------------------------------------------------------
From: Lin Yujun <linyujun809@huawei.com>
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.

Link: https://lkml.kernel.org/r/20220914033755.99924-1-linyujun809@huawei.com
Fixes: c01044cc8191 ("ACPI: HMAT: refactor hmat_register_target_device to hmem_register_device")
Signed-off-by: Lin Yujun <linyujun809@huawei.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: Joao Martins <joao.m.martins@oracle.com>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---


--- a/drivers/dax/hmem/device.c~acpi-hmat-release-platform-device-in-case-of-platform_device_add_data-fails
+++ a/drivers/dax/hmem/device.c
@@ -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 linyujun809@huawei.com are

acpi-hmat-release-platform-device-in-case-of-platform_device_add_data-fails.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-26 17:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-26 16:10 + acpi-hmat-release-platform-device-in-case-of-platform_device_add_data-fails.patch added to mm-unstable branch Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.