Staging: lustre: osc: remove unneeded null test before free
authorJulia Lawall <Julia.Lawall@lip6.fr>
Fri, 1 May 2015 19:37:50 +0000 (21:37 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 May 2015 07:23:56 +0000 (09:23 +0200)
Kfree can cope with a null argument, so drop null tests.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@ expression ptr; @@

- if (ptr != NULL)
  kfree(ptr);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/osc/osc_request.c

index 7ddf46b7ce438f2521cbb679cc1da6370be7409a..ded184edb50f75ee1b9af78202c9ece52ff5d220 100644 (file)
@@ -2064,8 +2064,7 @@ out:
 
                if (oa)
                        OBDO_FREE(oa);
-               if (pga)
-                       kfree(pga);
+               kfree(pga);
                /* this should happen rarely and is pretty bad, it makes the
                 * pending list not follow the dirty order */
                while (!list_empty(ext_list)) {