[PATCH 1/2] drm/atomic: Remove unneeded null check for private objects
Daniel Vetter
daniel at ffwll.ch
Wed Sep 27 10:10:35 UTC 2017
On Wed, Sep 27, 2017 at 10:35:31AM +0200, Maarten Lankhorst wrote:
> It can be seen in drm_atomic_get_private_obj_state() that
> ptr will never be NULL, so skip the check for that case.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> ---
> drivers/gpu/drm/drm_atomic.c | 3 ---
> include/drm/drm_atomic.h | 9 +++------
> 2 files changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 8bd5a1c4c7e8..29525bffdad9 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -182,9 +182,6 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state)
> for (i = 0; i < state->num_private_objs; i++) {
> struct drm_private_obj *obj = state->private_objs[i].ptr;
>
> - if (!obj)
> - continue;
> -
> obj->funcs->atomic_destroy_state(obj,
> state->private_objs[i].state);
> state->private_objs[i].ptr = NULL;
> diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
> index 5834580d75bc..6fae95f28e10 100644
> --- a/include/drm/drm_atomic.h
> +++ b/include/drm/drm_atomic.h
> @@ -768,8 +768,7 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);
> ((obj) = (__state)->private_objs[__i].ptr, \
> (old_obj_state) = (__state)->private_objs[__i].old_state, \
> (new_obj_state) = (__state)->private_objs[__i].new_state, 1); \
> - (__i)++) \
> - for_each_if (obj)
> + (__i)++)
>
> /**
> * for_each_old_private_obj_in_state - iterate over all private objects in an atomic update
> @@ -787,8 +786,7 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);
> (__i) < (__state)->num_private_objs && \
> ((obj) = (__state)->private_objs[__i].ptr, \
> (old_obj_state) = (__state)->private_objs[__i].old_state, 1); \
> - (__i)++) \
> - for_each_if (obj)
> + (__i)++)
>
> /**
> * for_each_new_private_obj_in_state - iterate over all private objects in an atomic update
> @@ -806,8 +804,7 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);
> (__i) < (__state)->num_private_objs && \
> ((obj) = (__state)->private_objs[__i].ptr, \
> (new_obj_state) = (__state)->private_objs[__i].new_state, 1); \
> - (__i)++) \
> - for_each_if (obj)
> + (__i)++)
>
> /**
> * drm_atomic_crtc_needs_modeset - compute combined modeset need
> --
> 2.14.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
More information about the dri-devel
mailing list