Staging: comedi: no need for checking vfree call
authorFigo.zhang <figo1802@gmail.com>
Sat, 6 Jun 2009 11:11:31 +0000 (19:11 +0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 15 Sep 2009 19:01:33 +0000 (12:01 -0700)
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>
drivers/staging/comedi/drivers.c

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