• Tomi Valkeinen's avatar
    drm/mipi-dsi: Fix detach call without attach · 90d50b8d
    Tomi Valkeinen authored
    It's been reported that DSI host driver's detach can be called without
    the attach ever happening:
    
    https://lore.kernel.org/all/20230412073954.20601-1-tony@atomide.com/
    
    After reading the code, I think this is what happens:
    
    We have a DSI host defined in the device tree and a DSI peripheral under
    that host (i.e. an i2c device using the DSI as data bus doesn't exhibit
    this behavior).
    
    The host driver calls mipi_dsi_host_register(), which causes (via a few
    functions) mipi_dsi_device_add() to be called for the DSI peripheral. So
    now we have a DSI device under the host, but attach hasn't been called.
    
    Normally the probing of the devices continues, and eventually the DSI
    peripheral's driver will call mipi_dsi_attach(), attaching the
    peripheral.
    
    However, if the host driver's probe encounters an error after calling
    mipi_dsi_host_register(), and before the peripheral has called
    mipi_dsi_attach(), the host driver will do cleanups and return an error
    from its probe funct...
    90d50b8d
drm_mipi_dsi.c 33.3 KB