When the .atomic_commit() handler fails, clean up planes previoulsy
prepared by drm_atomic_helper_prepare_planes() with a call to
drm_atomic_helper_cleanup_planes().
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
/* Allocate the commit object. */
commit = kzalloc(sizeof(*commit), GFP_KERNEL);
- if (commit == NULL)
- return -ENOMEM;
+ if (commit == NULL) {
+ ret = -ENOMEM;
+ goto error;
+ }
INIT_WORK(&commit->work, rcar_du_atomic_work);
commit->dev = dev;
if (ret) {
kfree(commit);
- return ret;
+ goto error;
}
/* Swap the state, this is the point of no return. */
rcar_du_atomic_complete(commit);
return 0;
+
+error:
+ drm_atomic_helper_cleanup_planes(dev, state);
+ return ret;
}
/* -----------------------------------------------------------------------------