On Tue, Sep 09, 2025 at 01:27:32PM +0200, Maxime Ripard wrote:
> The drm_atomic_state pointer passed to atomic_check is always valid, so
> checking if it's NULL or not is pointless. Remove the check.
> 
> Suggested-by: Ville Syrjälä <ville.syrj...@linux.intel.com>
> Signed-off-by: Maxime Ripard <mrip...@kernel.org>
> 
> ---
> To: Russell King <li...@armlinux.org.uk>
> ---
>  drivers/gpu/drm/armada/armada_plane.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/armada/armada_plane.c 
> b/drivers/gpu/drm/armada/armada_plane.c
> index 
> cc47c032dbc151a463cbd0b0d048c74c2828f253..976b6a271c912421e3fec7525f77234e73a74212
>  100644
> --- a/drivers/gpu/drm/armada/armada_plane.c
> +++ b/drivers/gpu/drm/armada/armada_plane.c
> @@ -83,25 +83,20 @@ int armada_drm_plane_atomic_check(struct drm_plane *plane,
>  {
>       struct drm_plane_state *new_plane_state = 
> drm_atomic_get_new_plane_state(state,
>                                                                               
>  plane);
>       struct armada_plane_state *st = to_armada_plane_state(new_plane_state);
>       struct drm_crtc *crtc = new_plane_state->crtc;
> -     struct drm_crtc_state *crtc_state;
> +     struct drm_crtc_state *crtc_state =
> +             drm_atomic_get_existing_crtc_state(state, crtc);

new_plane_state->crtc might be NULL here.

>       bool interlace;
>       int ret;
>  
>       if (!new_plane_state->fb || WARN_ON(!new_plane_state->crtc)) {
>               new_plane_state->visible = false;
>               return 0;
>       }
>  

Here we know it's not NULL.

> -     if (state)
> -             crtc_state = drm_atomic_get_existing_crtc_state(state,
> -                                                             crtc);
> -     else
> -             crtc_state = crtc->state;
> -
>       ret = drm_atomic_helper_check_plane_state(new_plane_state, crtc_state,
>                                                 0,
>                                                 INT_MAX, true, false);
>       if (ret)
>               return ret;
> 
> -- 
> 2.50.1

-- 
Ville Syrjälä
Intel

Reply via email to