linux-stable/drivers/cxl
Jonathan Cameron db9a3a35d3 cxl: Fix cleanup of port devices on failure to probe driver.
The device is created, and then there is a check if a driver succesfully
bound to it. In event of failing the bind (e.g. failure in cxl_port_probe())
the device is left registered. When a bus rescan later occurs, fresh
devices are created leading to a multiple device representing the same
underlying hardware. Bad things may follow and at very least we have far too many
devices.

Fix by ensuring autoremove is registered if the device create succeeds,
but doesn't depend on sucessful binding to a driver.

Bug was observed as side effect of incorrect ownership in
[PATCH v9 6/9] cxl/port: Read CDAT table
but will result from any failure to in cxl_port_probe().

Fixes: 8dd2bc0f8e ("cxl/mem: Add the cxl_mem driver")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Link: https://lore.kernel.org/r/20220609134519.11668-1-Jonathan.Cameron@huawei.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2022-06-21 14:09:00 -07:00
..
core cxl/port: Enable HDM Capability after validating DVSEC Ranges 2022-05-20 12:30:53 -07:00
acpi.c cxl/acpi: Add root device lockdep validation 2022-04-28 14:01:54 -07:00
cxl.h cxl: Drop cxl_device_lock() 2022-04-28 14:01:55 -07:00
cxlmem.h cxl/mem: Consolidate CXL DVSEC Range enumeration in the core 2022-05-19 08:50:41 -07:00
cxlpci.h cxl/port: Reuse 'struct cxl_hdm' context for hdm init 2022-05-19 08:50:42 -07:00
Kconfig PM: CXL: Disable suspend 2022-04-22 16:09:42 -07:00
Makefile PM: CXL: Disable suspend 2022-04-22 16:09:42 -07:00
mem.c cxl: Fix cleanup of port devices on failure to probe driver. 2022-06-21 14:09:00 -07:00
pci.c cxl/mem: Consolidate CXL DVSEC Range enumeration in the core 2022-05-19 08:50:41 -07:00
pmem.c cxl: Drop cxl_device_lock() 2022-04-28 14:01:55 -07:00
port.c cxl/port: Reuse 'struct cxl_hdm' context for hdm init 2022-05-19 08:50:42 -07:00