Skip to content

Commit

Permalink
drivers/gpu/drm/drm_buffer.c: remove unnecessary null test before kfree
Browse files Browse the repository at this point in the history
This patch removes special case of last element and loops from idx to 0.

Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
  • Loading branch information
Fabian Frederick authored and Daniel Vetter committed Jul 18, 2014
1 parent 2aa9d2b commit 74f2078
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions drivers/gpu/drm/drm_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,7 @@ int drm_buffer_alloc(struct drm_buffer **buf, int size)

error_out:

/* Only last element can be null pointer so check for it first. */
if ((*buf)->data[idx])
kfree((*buf)->data[idx]);

for (--idx; idx >= 0; --idx)
for (; idx >= 0; --idx)
kfree((*buf)->data[idx]);

kfree(*buf);
Expand Down

0 comments on commit 74f2078

Please sign in to comment.