cxl: Fix device reference leak in cxl_port_perf_data_calculate()
authorDave Jiang <dave.jiang@intel.com>
Fri, 5 Jan 2024 22:07:46 +0000 (15:07 -0700)
committerDan Williams <dan.j.williams@intel.com>
Fri, 5 Jan 2024 22:36:29 +0000 (14:36 -0800)
commit98e7ab3345e105339b7d919b4918f3c1879052ed
treecb0921c93e842461450c1f46fad576e3f331eaf8
parent44cd71ef7bacdfcf7c3e8a7b13f11a7eba69533d
cxl: Fix device reference leak in cxl_port_perf_data_calculate()

cxl_port_perf_data_calculate() calls find_cxl_root() and does not
dereference the 'struct device' in the cxl_root->port. find_cxl_root()
calls get_device() and takes a reference on the port 'struct device'
member. Use the __free() macro to ensure the dereference happens.

Fixes: 7a4f148dd8d5 ("cxl: Compute the entire CXL path latency and bandwidth data")
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/170449246681.3779673.2288926019977963333.stgit@djiang5-mobl3
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/cxl/core/cdat.c