Skip to content

Commit

Permalink
drm: rcar-du: Clean up planes in the error paths of .atomic_commit()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Laurent Pinchart authored and Laurent Pinchart committed Jun 16, 2015
1 parent 898a2f3 commit 39a3d57
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions drivers/gpu/drm/rcar-du/rcar_du_kms.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,10 @@ static int rcar_du_atomic_commit(struct drm_device *dev,

/* 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;
Expand All @@ -519,7 +521,7 @@ static int rcar_du_atomic_commit(struct drm_device *dev,

if (ret) {
kfree(commit);
return ret;
goto error;
}

/* Swap the state, this is the point of no return. */
Expand All @@ -531,6 +533,10 @@ static int rcar_du_atomic_commit(struct drm_device *dev,
rcar_du_atomic_complete(commit);

return 0;

error:
drm_atomic_helper_cleanup_planes(dev, state);
return ret;
}

/* -----------------------------------------------------------------------------
Expand Down

0 comments on commit 39a3d57

Please sign in to comment.