Browse Source

audit: Delete unnecessary checks before two function calls

The functions consume_skb() and kfree_skb() test whether their argument
is NULL and then return immediately.
Thus the tests around their calls are not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
[PM: tweak patch prefix]
Signed-off-by: Paul Moore <pmoore@redhat.com>
Markus Elfring 9 years ago
parent
commit
d865e573b8
1 changed files with 2 additions and 5 deletions
  1. 2 5
      kernel/audit.c

+ 2 - 5
kernel/audit.c

@@ -508,8 +508,7 @@ static void flush_hold_queue(void)
 	 * if auditd just disappeared but we
 	 * if auditd just disappeared but we
 	 * dequeued an skb we need to drop ref
 	 * dequeued an skb we need to drop ref
 	 */
 	 */
-	if (skb)
-		consume_skb(skb);
+	consume_skb(skb);
 }
 }
 
 
 static int kauditd_thread(void *dummy)
 static int kauditd_thread(void *dummy)
@@ -1232,9 +1231,7 @@ static void audit_buffer_free(struct audit_buffer *ab)
 	if (!ab)
 	if (!ab)
 		return;
 		return;
 
 
-	if (ab->skb)
-		kfree_skb(ab->skb);
-
+	kfree_skb(ab->skb);
 	spin_lock_irqsave(&audit_freelist_lock, flags);
 	spin_lock_irqsave(&audit_freelist_lock, flags);
 	if (audit_freelist_count > AUDIT_MAXFREE)
 	if (audit_freelist_count > AUDIT_MAXFREE)
 		kfree(ab);
 		kfree(ab);