diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 8ce2a0507970..9f46179ef620 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -1277,7 +1277,7 @@ EXPORT_SYMBOL(tcf_block_cb_unregister);
 int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp,
 		 struct tcf_result *res, bool compat_mode)
 {
-	__be16 protocol = tc_skb_protocol(skb);
+	__be16 protocol;
 #ifdef CONFIG_NET_CLS_ACT
 	const int max_reclassify_loop = 4;
 	const struct tcf_proto *orig_tp = tp;
@@ -1288,6 +1288,7 @@ int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp,
 #endif
 	for (; tp; tp = rcu_dereference_bh(tp->next)) {
 		int err;
+		protocol = tc_skb_protocol(skb);
 
 		if (tp->protocol != protocol &&
 		    tp->protocol != htons(ETH_P_ALL))
@@ -1319,7 +1320,6 @@ int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp,
 	}
 
 	tp = first_tp;
-	protocol = tc_skb_protocol(skb);
 	goto reclassify;
 #endif
 }
