Przeglądaj źródła

Staging: comedi: no need for checking vfree call

vfree() does it's own NULL checking,so no need for check before
calling it.

'pages' is local variable argment,so in v2, it is no need assignment
 to NULL.

Signed-off-by: Figo.zhang <figo1802@gmail.com>
Acked-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Figo.zhang 16 lat temu
rodzic
commit
b455073c88
1 zmienionych plików z 2 dodań i 3 usunięć
  1. 2 3
      drivers/staging/comedi/drivers.c

+ 2 - 3
drivers/staging/comedi/drivers.c

@@ -509,9 +509,8 @@ int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s,
 			async->prealloc_buf =
 			async->prealloc_buf =
 			    vmap(pages, n_pages, VM_MAP, PAGE_KERNEL_NOCACHE);
 			    vmap(pages, n_pages, VM_MAP, PAGE_KERNEL_NOCACHE);
 		}
 		}
-		if (pages) {
-			vfree(pages);
-		}
+		vfree(pages);
+
 		if (async->prealloc_buf == NULL) {
 		if (async->prealloc_buf == NULL) {
 			/* Some allocation failed above. */
 			/* Some allocation failed above. */
 			if (async->buf_page_list) {
 			if (async->buf_page_list) {