[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] remove pointless NULL check before calling kfree



# HG changeset patch
# User vh249@xxxxxxxxxxxxxxxxxxxxxx
# Node ID ac6605bceb9dbb817da5cccc272c80d3224b71c3
# Parent  864d936a04827f9f02436cbea46b69644c0e5082
remove pointless NULL check before calling kfree

Signed-off-by: Vincent Hanquez <vincent@xxxxxxxxxxxxx>

diff -r 864d936a0482 -r ac6605bceb9d 
linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Sat Sep 10 14:38:01 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Sat Sep 10 14:41:16 2005
@@ -48,8 +48,7 @@
        unregister_xenbus_watch(&be->backend_watch);
        if (be->blkif)
                blkif_put(be->blkif);
-       if (be->frontpath)
-               kfree(be->frontpath);
+       kfree(be->frontpath);
        kfree(be);
        return 0;
 }
@@ -255,8 +254,7 @@
  free_be:
        if (be->backend_watch.node)
                unregister_xenbus_watch(&be->backend_watch);
-       if (frontend)
-               kfree(frontend);
+       kfree(frontend);
        kfree(be);
        return err;
 }
diff -r 864d936a0482 -r ac6605bceb9d 
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Sat Sep 10 
14:38:01 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Sat Sep 10 
14:41:16 2005
@@ -608,8 +608,7 @@
        }
 
  out:
-       if (backend)
-               kfree(backend);
+       kfree(backend);
        return err;
 
  abort_transaction:
diff -r 864d936a0482 -r ac6605bceb9d 
linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c  Sat Sep 10 14:38:01 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blktap/xenbus.c  Sat Sep 10 14:41:16 2005
@@ -52,8 +52,7 @@
        unregister_xenbus_watch(&be->backend_watch);
        if (be->blkif)
                blkif_put(be->blkif);
-       if (be->frontpath)
-               kfree(be->frontpath);
+       kfree(be->frontpath);
        kfree(be);
        return 0;
 }
@@ -200,8 +199,7 @@
  free_be:
        if (be->backend_watch.node)
                unregister_xenbus_watch(&be->backend_watch);
-       if (frontend)
-               kfree(frontend);
+       kfree(frontend);
        kfree(be);
        return err;
 }
diff -r 864d936a0482 -r ac6605bceb9d 
linux-2.6-xen-sparse/drivers/xen/netback/loopback.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/loopback.c       Sat Sep 10 
14:38:01 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/loopback.c       Sat Sep 10 
14:41:16 2005
@@ -160,10 +160,8 @@
        return 0;
 
  fail:
-       if (dev1 != NULL)
-               kfree(dev1);
-       if (dev2 != NULL)
-               kfree(dev2);
+       kfree(dev1);
+       kfree(dev2);
        return err;
 }
 
diff -r 864d936a0482 -r ac6605bceb9d 
linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Sat Sep 10 14:38:01 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c Sat Sep 10 14:41:16 2005
@@ -50,8 +50,7 @@
        unregister_xenbus_watch(&be->backend_watch);
        if (be->netif)
                netif_disconnect(be->netif);
-       if (be->frontpath)
-               kfree(be->frontpath);
+       kfree(be->frontpath);
        kfree(be);
        return 0;
 }
@@ -270,8 +269,7 @@
  free_be:
        if (be->backend_watch.node)
                unregister_xenbus_watch(&be->backend_watch);
-       if (frontend)
-               kfree(frontend);
+       kfree(frontend);
        kfree(be);
        return err;
 }
diff -r 864d936a0482 -r ac6605bceb9d 
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Sat Sep 10 
14:38:01 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Sat Sep 10 
14:41:16 2005
@@ -1232,8 +1232,7 @@
        netif_state = NETIF_STATE_CONNECTED;
 
  out:
-       if (backend)
-               kfree(backend);
+       kfree(backend);
        return err;
 
  abort_transaction:
diff -r 864d936a0482 -r ac6605bceb9d 
linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c
--- a/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c        Sat Sep 10 
14:38:01 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c        Sat Sep 10 
14:41:16 2005
@@ -148,9 +148,7 @@
 packet_free(struct packet *pak)
 {
        del_singleshot_timer_sync(&pak->processing_timer);
-       if (pak->data_buffer) {
-               kfree(pak->data_buffer);
-       }
+       kfree(pak->data_buffer);
        /*
         * cannot do tpmif_put(pak->tpmif); bad things happen
         * on the last tpmif_put()
diff -r 864d936a0482 -r ac6605bceb9d 
linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c Sat Sep 10 14:38:01 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c Sat Sep 10 14:41:16 2005
@@ -52,8 +52,7 @@
                tpmif_put(be->tpmif);
        }
 
-       if (be->frontpath)
-               kfree(be->frontpath);
+       kfree(be->frontpath);
        kfree(be);
        return 0;
 }
@@ -243,8 +242,7 @@
 free_be:
        if (be->backend_watch.node)
                unregister_xenbus_watch(&be->backend_watch);
-       if (frontend)
-               kfree(frontend);
+       kfree(frontend);
        kfree(be);
        return err;
 }
diff -r 864d936a0482 -r ac6605bceb9d 
linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c      Sat Sep 10 
14:38:01 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c      Sat Sep 10 
14:41:16 2005
@@ -363,8 +363,7 @@
        }
 
 out:
-       if (backend)
-               kfree(backend);
+       kfree(backend);
        return err;
 
 abort_transaction:
diff -r 864d936a0482 -r ac6605bceb9d 
linux-2.6-xen-sparse/drivers/xen/usbback/usbback.c
--- a/linux-2.6-xen-sparse/drivers/xen/usbback/usbback.c        Sat Sep 10 
14:38:01 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/usbback/usbback.c        Sat Sep 10 
14:41:16 2005
@@ -781,8 +781,7 @@
     return;
     
  no_mem:
-    if ( setup != NULL )
-        kfree(setup);
+    kfree(setup);
     make_response(up, req->id, req->operation, -ENOMEM, 0, 0);
     return;
 } 
diff -r 864d936a0482 -r ac6605bceb9d 
linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront.c      Sat Sep 10 
14:38:01 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront.c      Sat Sep 10 
14:41:16 2005
@@ -1720,8 +1720,7 @@
        return 0;
 
 up_failed:
-       if (errbuf)
-               kfree(errbuf);
+       kfree(errbuf);
 
 errbuf_failed:
        return retval;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.