Browse Source

drivers/gpu/drm/drm_buffer.c: remove unnecessary null test before kfree

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>
Fabian Frederick 11 years ago
parent
commit
74f20788a7
1 changed files with 1 additions and 5 deletions
  1. 1 5
      drivers/gpu/drm/drm_buffer.c

+ 1 - 5
drivers/gpu/drm/drm_buffer.c

@@ -80,11 +80,7 @@ int drm_buffer_alloc(struct drm_buffer **buf, int size)
 
 
 error_out:
 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)->data[idx]);
 
 
 	kfree(*buf);
 	kfree(*buf);