summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Price <gourry@gourry.net>2026-03-27 05:02:03 +0300
committerDave Jiang <dave.jiang@intel.com>2026-03-27 21:45:39 +0300
commit29990ab5cb408d5aa15939d6535e3291aeef748b (patch)
treed72d8cafd49f8adce99acb71cef77dd1389a10a0
parentd747cf98f091e56beeed5233e8992fea59401011 (diff)
downloadlinux-29990ab5cb408d5aa15939d6535e3291aeef748b.tar.xz
cxl/core: use cleanup.h for devm_cxl_add_dax_region
Cleanup the gotos in the function. No functional change. Signed-off-by: Gregory Price <gourry@gourry.net> Reviewed-by: Ira Weiny <ira.weiny@intel.com> Reviewed-by: Alison Schofield <alison.schofield@intel.com> Link: https://patch.msgid.link/20260327020203.876122-4-gourry@gourry.net Signed-off-by: Dave Jiang <dave.jiang@intel.com>
-rw-r--r--drivers/cxl/core/region_dax.c13
-rw-r--r--drivers/cxl/cxl.h1
2 files changed, 6 insertions, 8 deletions
diff --git a/drivers/cxl/core/region_dax.c b/drivers/cxl/core/region_dax.c
index fe367759ac69..de04f78f6ad8 100644
--- a/drivers/cxl/core/region_dax.c
+++ b/drivers/cxl/core/region_dax.c
@@ -81,29 +81,26 @@ static void cxlr_dax_unregister(void *_cxlr_dax)
int devm_cxl_add_dax_region(struct cxl_region *cxlr)
{
- struct cxl_dax_region *cxlr_dax;
struct device *dev;
int rc;
- cxlr_dax = cxl_dax_region_alloc(cxlr);
+ struct cxl_dax_region *cxlr_dax __free(put_cxl_dax_region) =
+ cxl_dax_region_alloc(cxlr);
if (IS_ERR(cxlr_dax))
return PTR_ERR(cxlr_dax);
dev = &cxlr_dax->dev;
rc = dev_set_name(dev, "dax_region%d", cxlr->id);
if (rc)
- goto err;
+ return rc;
rc = device_add(dev);
if (rc)
- goto err;
+ return rc;
dev_dbg(&cxlr->dev, "%s: register %s\n", dev_name(dev->parent),
dev_name(dev));
return devm_add_action_or_reset(&cxlr->dev, cxlr_dax_unregister,
- cxlr_dax);
-err:
- put_device(dev);
- return rc;
+ no_free_ptr(cxlr_dax));
}
diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
index 9b947286eb9b..7f63a62c2a5f 100644
--- a/drivers/cxl/cxl.h
+++ b/drivers/cxl/cxl.h
@@ -808,6 +808,7 @@ DEFINE_FREE(put_cxl_root, struct cxl_root *, if (_T) put_device(&_T->port.dev))
DEFINE_FREE(put_cxl_port, struct cxl_port *, if (!IS_ERR_OR_NULL(_T)) put_device(&_T->dev))
DEFINE_FREE(put_cxl_root_decoder, struct cxl_root_decoder *, if (!IS_ERR_OR_NULL(_T)) put_device(&_T->cxlsd.cxld.dev))
DEFINE_FREE(put_cxl_region, struct cxl_region *, if (!IS_ERR_OR_NULL(_T)) put_device(&_T->dev))
+DEFINE_FREE(put_cxl_dax_region, struct cxl_dax_region *, if (!IS_ERR_OR_NULL(_T)) put_device(&_T->dev))
int devm_cxl_enumerate_ports(struct cxl_memdev *cxlmd);
void cxl_bus_rescan(void);