diff options
author | Li Ming <ming4.li@intel.com> | 2024-08-30 01:31:38 +0000 |
---|---|---|
committer | Dave Jiang <dave.jiang@intel.com> | 2024-09-03 14:49:49 -0700 |
commit | 91c0e9d6a205ab0e318dc0dc6e72cbbdb21f8094 (patch) | |
tree | 1775cab865b92e0a5dbb0c131bb6cf0a5e15c90e /tools/perf/scripts/python/export-to-sqlite.py | |
parent | 7f569e917b7866b6760e2cfc3a9549cabc890071 (diff) |
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>
Diffstat (limited to 'tools/perf/scripts/python/export-to-sqlite.py')
0 files changed, 0 insertions, 0 deletions