Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] drm/panel: novatek_enable() reaches into drm_panel core
  panel->prepared state
--

commit a50376adf296c5b8a35b17ec581a70a2368b7e12
Author: Qianhui Xu <[email protected]>

drm/panel: novatek-nt36536: reject enable when prepare failed

This commit adds a novatek_enable() callback that checks panel->prepared and
returns -EIO so the panel is not marked enabled when novatek_prepare() fails.

> diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36536.c 
> b/drivers/gpu/drm/panel/panel-novatek-nt36536.c
> index 88a003f5a9441..698e7b85a8a76 100644
> --- a/drivers/gpu/drm/panel/panel-novatek-nt36536.c
> +++ b/drivers/gpu/drm/panel/panel-novatek-nt36536.c
> @@ -123,6 +123,12 @@ static int novatek_prepare(struct drm_panel *panel)
>       return ret;
>  }
>  
> +static int novatek_enable(struct drm_panel *panel)
> +{
> +     /* The bridge enable chain can continue after a failed prepare 
> callback. */
> +     return panel->prepared ? 0 : -EIO;
> +}
> +
>  static int novatek_off(struct mipi_dsi_multi_context *dsi_ctx)
>  {
>       mipi_dsi_dcs_set_display_off_multi(dsi_ctx);
> @@ -186,6 +192,7 @@ static int novatek_get_modes(struct drm_panel *panel,
>  
>  static const struct drm_panel_funcs novatek_panel_funcs = {
>       .prepare = novatek_prepare,
> +     .enable = novatek_enable,
>       .unprepare = novatek_unprepare,
>       .get_modes = novatek_get_modes,
>  };

[Severity: Low]
Should this panel->prepared check live in drm_panel_enable() instead of
adding a dummy novatek_enable() callback that reaches into core drm_panel
state?

Commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in
drm_panel") moved panel->prepared and panel->enabled tracking into
drivers/gpu/drm/drm_panel.c so individual panel drivers would not inspect
those fields directly.  Also, the commit message states that checking
panel->prepared in drm_panel_enable() would skip panels that never implement
prepare(), but drm_panel_prepare() sets panel->prepared = true even when
panel->funcs->prepare is NULL:

drivers/gpu/drm/drm_panel.c:drm_panel_prepare() {
        ...
        if (panel->funcs && panel->funcs->prepare) {
                ret = panel->funcs->prepare(panel);
                if (ret < 0)
                        goto exit;
        }
        panel->prepared = true;
        ...
}

Handling !panel->prepared in drm_panel_enable() would avoid driver-specific
workarounds and keep behavior consistent across all panel drivers.

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=4

Reply via email to