The general consensus is that reset helpers shouldn't call memset directly because the object it initializes is supposed to have been zeroed out.
Remove the memset call from __drm_atomic_helper_bridge_reset() and document the expectation. It should not have any impact on the current code base since there's only two callers: drm_atomic_helper_bridge_reset() and cdns-mhdp8546-core's cdns_mhdp_bridge_atomic_reset(), both allocating the object using kzalloc_obj(). Suggested-by: Thomas Zimmermann <[email protected]> Signed-off-by: Maxime Ripard <[email protected]> --- drivers/gpu/drm/drm_atomic_state_helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c index 07686e94aae0..71a02ba78f2f 100644 --- a/drivers/gpu/drm/drm_atomic_state_helper.c +++ b/drivers/gpu/drm/drm_atomic_state_helper.c @@ -892,15 +892,16 @@ EXPORT_SYMBOL(drm_atomic_helper_bridge_destroy_state); * @state: bridge state to initialize * * Initializes the bridge state to default values. This is meant to be called * by the bridge &drm_bridge_funcs.atomic_reset hook for bridges that subclass * the bridge state. + * + * The object @state points to is assumed to have been initialized to zero. */ void __drm_atomic_helper_bridge_reset(struct drm_bridge *bridge, struct drm_bridge_state *state) { - memset(state, 0, sizeof(*state)); __drm_atomic_helper_private_obj_create_state(&bridge->base, &state->base); state->bridge = bridge; } EXPORT_SYMBOL(__drm_atomic_helper_bridge_reset); -- 2.54.0
