linux-stable/drivers/cxl
Li Ming 91c0e9d6a2 cxl/port: Refactor __devm_cxl_add_port() to drop goto pattern
In __devm_cxl_add_port(), there is a 'goto' to call put_device() for the
error cases between device_initialize() and device_add() to dereference
the 'struct device' of a new cxl_port. The 'goto' pattern in the case
can be removed by refactoring. Introducing a new function called
cxl_port_add() which is used to add the 'struct device' of a new
cxl_port to device hierarchy, moving the functions needing the help of
the 'goto' into cxl_port_add(), and using a scoped-based resource
management __free() to drop the open coded put_device() and the 'goto'
for the error cases.

Suggested-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Li Ming <ming4.li@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huwaei.com>
Link: https://patch.msgid.link/20240830013138.2256244-3-ming4.li@intel.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
2024-09-03 14:49:49 -07:00
..
core cxl/port: Refactor __devm_cxl_add_port() to drop goto pattern 2024-09-03 14:49:49 -07:00
acpi.c Merge branch 'for-6.11/xor_fixes' into cxl-for-next 2024-07-11 16:47:47 -07:00
cxl.h cxl/port: Use __free() to drop put_device() for cxl_port 2024-09-03 14:49:48 -07:00
cxlmem.h CXL for v6.11 merge window 2024-07-28 09:33:28 -07:00
cxlpci.h PCI/CXL: Move CXL Vendor ID to pci_ids.h 2024-05-08 13:18:33 -05:00
Kconfig cxl: Fix use of phys_to_target_node() for x86 2024-04-30 10:43:48 -07:00
Makefile cxl/pmem: Introduce nvdimm_security_ops with ->get_flags() operation 2022-11-30 16:30:47 -08:00
mem.c cxl/port: Use scoped_guard()/guard() to drop device_lock() for cxl_port 2024-09-03 14:49:49 -07:00
pci.c cxl/port: Use __free() to drop put_device() for cxl_port 2024-09-03 14:49:48 -07:00
pmem.c cxl/port: Use scoped_guard()/guard() to drop device_lock() for cxl_port 2024-09-03 14:49:49 -07:00
pmu.h cxl/pci: Find and register CXL PMU devices 2023-05-30 11:20:35 -07:00
port.c cxl: add missing MODULE_DESCRIPTION() macros 2024-07-02 12:52:26 -07:00
security.c Merge branch 'for-6.5/cxl-type-2' into for-6.5/cxl 2023-06-25 17:16:51 -07:00