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 7c02053e6a9ffe7daf7c01542d46afe0038e03e1
Author: Maxime Ripard <[email protected]>

drm/tidss: kms: Hook up hardware state readout

This commit wires up the atomic state readout helper callbacks in
mode_config_funcs and mode_config_helper_funcs to enable hardware state
readout for the tidss driver.

> diff --git a/drivers/gpu/drm/tidss/tidss_kms.c 
> b/drivers/gpu/drm/tidss/tidss_kms.c
> index fd7bb2c88931d..32e11e36627db 100644
> --- a/drivers/gpu/drm/tidss/tidss_kms.c
> +++ b/drivers/gpu/drm/tidss/tidss_kms.c
[ ... ]
> @@ -64,7 +66,9 @@ static void tidss_atomic_commit_tail(struct 
> drm_atomic_commit *old_state)
>  }
>  
>  static const struct drm_mode_config_helper_funcs mode_config_helper_funcs = {
> -     .atomic_commit_tail = tidss_atomic_commit_tail,
> +     .atomic_commit_tail     = tidss_atomic_commit_tail,
> +     .atomic_sro_build_state = drm_atomic_helper_sro_build_state,
> +     .atomic_sro_install_state = drm_atomic_helper_sro_install_state,
>  };

[Severity: Medium]
Does enabling drm_atomic_helper_sro_build_state() expose an unchecked
tidss_runtime_get() in tidss_crtc_readout_state()?

drivers/gpu/drm/tidss/tidss_crtc.c:tidss_crtc_readout_state() {
        ...
        tidss_runtime_get(tidss);

        if (!dispc_vp_is_enabled(dispc, tcrtc->hw_videoport))
                goto out;
        ...
out:
        tidss_runtime_put(tidss);
        return 0;
}

tidss_runtime_get() wraps pm_runtime_resume_and_get(), which drops the
runtime PM reference on error.  Unlike tidss_crtc_install_state() and
tidss_plane_atomic_readout_state(), tidss_crtc_readout_state() ignores a
negative return value, reads DISPC registers while the device is still
suspended, and calls tidss_runtime_put() on exit, underflowing the
runtime PM usage count.

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

Reply via email to