]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
cxl/mem: Convert devm_cxl_add_memdev() to scope-based-cleanup
authorDan Williams <dan.j.williams@intel.com>
Tue, 16 Dec 2025 00:56:14 +0000 (16:56 -0800)
committerDave Jiang <dave.jiang@intel.com>
Mon, 5 Jan 2026 17:14:36 +0000 (10:14 -0700)
commit6e1d21903ff213f1384ce43daa279c0965904116
tree0391efbd3a27ab103a1288f9cd01407c1c550729
parentae201a0092362ffdec7206efa1ec85e260fab8d2
cxl/mem: Convert devm_cxl_add_memdev() to scope-based-cleanup

In preparation for adding more setup steps, convert the current
implementation to scope-based cleanup.

The cxl_memdev_shutdown() is only required after cdev_device_add(). With
that moved to a helper function it precludes the need to add
scope-based-handler for that cleanup if devm_add_action_or_reset() fails.

Cc: Smita Koralahalli <Smita.KoralahalliChannabasappa@amd.com>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Ben Cheatham <benjamin.cheatham@amd.com>
Tested-by: Alejandro Lucero <alucerop@amd.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Link: https://patch.msgid.link/20251216005616.3090129-5-dan.j.williams@intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
drivers/cxl/core/memdev.c