Re: [PATCH] omap: dsi: do not WARN on detach if dsidev was never attached

From: Sebastian Reichel
Date: Wed Sep 20 2023 - 15:41:24 EST


Hi,

On Tue, Sep 19, 2023 at 03:37:28PM +0200, H. Nikolaus Schaller wrote:
> dsi_init_output() called by dsi_probe() may fail. In that
> case mipi_dsi_host_unregister() is called which may call
> omap_dsi_host_detach() with uninitialized dsi->dsidev
> because omap_dsi_host_attach() was never called before.
>
> This happens if the panel driver asks for an EPROBE_DEFER.
>
> So let's suppress the WARN() in this special case.

...

> Signed-off-by: H. Nikolaus Schaller <hns@xxxxxxxxxxxxx>
> ---

Reviewed-by: Sebastian Reichel <sebastian.reichel@xxxxxxxxxxxxx>

-- Sebastian

> drivers/gpu/drm/omapdrm/dss/dsi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index ea63c64d3a1ab..c37eb6b1b9a39 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -4411,7 +4411,7 @@ static int omap_dsi_host_detach(struct mipi_dsi_host *host,
> {
> struct dsi_data *dsi = host_to_omap(host);
>
> - if (WARN_ON(dsi->dsidev != client))
> + if (!dsi->dsidev || WARN_ON(dsi->dsidev != client))
> return -EINVAL;
>
> cancel_delayed_work_sync(&dsi->dsi_disable_work);
> --
> 2.42.0
>

Attachment: signature.asc
Description: PGP signature