Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/tidss: unchecked tidss_runtime_get() in
  tidss_crtc_readout_state()
--

commit 27f832761d364d1ee42dec3bb9847c031048e245
Author: Maxime Ripard <[email protected]>

drm/tidss: crtc: Implement hardware state readout

This commit implements the CRTC atomic state readout, installation, and
comparison callbacks for tidss so that video ports left running by
firmware can be adopted at probe time.

> diff --git a/drivers/gpu/drm/tidss/tidss_crtc.c 
> b/drivers/gpu/drm/tidss/tidss_crtc.c
> index d2664bda53a99..c72194e93bde1 100644
> --- a/drivers/gpu/drm/tidss/tidss_crtc.c
> +++ b/drivers/gpu/drm/tidss/tidss_crtc.c
[ ... ]
> @@ -372,6 +376,131 @@ static struct drm_crtc_state 
> *tidss_crtc_create_state(struct drm_crtc *crtc)
>       return &tstate->base;
>  }
>  
> +static int tidss_crtc_readout_state(struct drm_crtc *crtc,
> +                                 struct drm_atomic_sro_state *state,
> +                                 struct drm_crtc_state *crtc_state)
> +{
> +     struct drm_device *ddev = crtc->dev;
> +     struct tidss_device *tidss = to_tidss(ddev);
> +     struct dispc_device *dispc = tidss->dispc;
> +     struct tidss_crtc_state *tstate = to_tidss_crtc_state(crtc_state);
> +     struct tidss_crtc *tcrtc =
> +             to_tidss_crtc(crtc);
> +     struct drm_display_mode mode = {};
> +     int ret;
> +
> +     tidss_runtime_get(tidss);
> +
> +     if (!dispc_vp_is_enabled(dispc, tcrtc->hw_videoport))
> +             goto out;

[Severity: Medium]
Should tidss_crtc_readout_state() check the return value of
tidss_runtime_get(tidss), as tidss_crtc_install_state() does below?

tidss_runtime_get() wraps pm_runtime_resume_and_get(), which drops the
runtime PM reference when it returns a negative error code.  If resume
fails, continuing will read DISPC registers while the device is suspended
and then unconditionally call tidss_runtime_put(tidss) on exit,
underflowing the runtime PM usage counter.

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

Reply via email to