Skip to contentSkip to conversation

nfnetlink_log: kill duplicate code

PATCH Applied Michał Mirosław 2 participants 2 messages Feb 12, 2007 – Feb 13, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/10 nfnetlink_log: kill duplicate code

Kill some duplicate code in nfulnl_log_packet().

net/netfilter/nfnetlink_log.c renamed from net/netfilter/nfnetlink_log.c.1 +8 -15
@@ -666,30 +666,23 @@ nfulnl_log_packet(unsigned int pf,
 		break;
 	
 	default:
-		spin_unlock_bh(&inst->lock);
-		instance_put(inst);
-		return;
+		goto unlock_and_release;
 	}
 
-	if (!inst->skb) {
-		if (!(inst->skb = nfulnl_alloc_skb(inst->nlbufsiz, size))) {
-			UDEBUG("error in nfulnl_alloc_skb(%u, %u)\n",
-				inst->nlbufsiz, size);
-			goto alloc_failure;
-		}
-	} else if (inst->qlen >= qthreshold ||
-		   size > skb_tailroom(inst->skb)) {
+	if (inst->qlen >= qthreshold ||
+		   (inst->skb && size > skb_tailroom(inst->skb))) {
 		/* either the queue len is too high or we don't have
 		 * enough room in the skb left. flush to userspace. */
 		UDEBUG("flushing old skb\n");
 
 		__nfulnl_send(inst);
+	}
 
-		if (!(inst->skb = nfulnl_alloc_skb(inst->nlbufsiz, size))) {
-			UDEBUG("error in nfulnl_alloc_skb(%u, %u)\n",
-				inst->nlbufsiz, size);
+	if (!inst->skb) {
+		inst->skb = nfulnl_alloc_skb(inst->nlbufsiz, size);
+
+		if (!inst->skb)
 			goto alloc_failure;
-		}
 	}
 
 	UDEBUG("qlen %d, qthreshold %d\n", inst->qlen, qthreshold);
#1 lore raw
Quoted 1 line · Micha³ Miros³aw

Kill some duplicate code in nfulnl_log_packet().

Applied.