DSI device registering and attaching needs to be undone upon deregistration. This fixes module unload/load. Fixes: bbfd3190b656 ("drm/bridge: tc358767: Add DSI-to-DPI mode support") Signed-off-by: Alexander Stein <alexander.stein@xxxxxxxxxxxxxxx> --- Just for the record the (reduced) call trace: sysfs: cannot create duplicate filename '/devices/platform/soc@0/32c00000.bus/32e60000.dsi/32e60000.dsi.0' CPU: 2 PID: 445 Comm: modprobe Not tainted 6.4.0-rc2-next-20230517+ #1682 5d8500234c8d4f852cf1af088c7787a58761a89a Hardware name: TQ-Systems i.MX8MPlus TQMa8MPxL on MBa8MPxL (DT) Call trace: dump_backtrace+0x94/0x110 show_stack+0x14/0x1c dump_stack_lvl+0x44/0x58 dump_stack+0x14/0x1c sysfs_warn_dup+0x60/0x78 sysfs_create_dir_ns+0xdc/0xf4 create_dir+0x28/0x108 kobject_add_internal+0x88/0x204 kobject_add+0x90/0x104 device_add+0xf8/0x4fc mipi_dsi_device_register_full.part.0+0xc4/0x148 mipi_dsi_device_register_full+0x1c/0x58 tc_mipi_dsi_host_attach+0xa0/0x140 [tc358767 28feaae6fd7f7414a09273d9032c2a0e1f2a8870] tc_probe+0x364/0x528 [tc358767 28feaae6fd7f7414a09273d9032c2a0e1f2a8870] i2c_device_probe+0x100/0x2d8 drivers/gpu/drm/bridge/tc358767.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 37731aaa45f4..82f9fe14e5f9 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -2108,7 +2108,7 @@ static int tc_mipi_dsi_host_attach(struct tc_data *tc) if (dsi_lanes < 0) return dsi_lanes; - dsi = mipi_dsi_device_register_full(host, &info); + dsi = devm_mipi_dsi_device_register_full(dev, host, &info); if (IS_ERR(dsi)) return dev_err_probe(dev, PTR_ERR(dsi), "failed to create dsi device\n"); @@ -2119,7 +2119,7 @@ static int tc_mipi_dsi_host_attach(struct tc_data *tc) dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | MIPI_DSI_MODE_LPM | MIPI_DSI_CLOCK_NON_CONTINUOUS; - ret = mipi_dsi_attach(dsi); + ret = devm_mipi_dsi_attach(dev, dsi); if (ret < 0) { dev_err(dev, "failed to attach dsi to host: %d\n", ret); return ret; -- 2.34.1