--- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
+++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
-@@ -561,6 +561,7 @@ mtk_eth_setup_tc_block(struct net_device
- struct mtk_eth *eth = mac->hw;
- static LIST_HEAD(block_cb_list);
- struct flow_block_cb *block_cb;
-+ bool register_block = false;
- flow_setup_cb_t *cb;
+@@ -583,6 +583,7 @@ mtk_eth_setup_tc_block(struct net_device
+ if (IS_ERR(block_cb))
+ return PTR_ERR(block_cb);
- if (!eth->soc->offload_version)
-@@ -575,23 +576,27 @@ mtk_eth_setup_tc_block(struct net_device
- switch (f->command) {
- case FLOW_BLOCK_BIND:
- block_cb = flow_block_cb_lookup(f->block, cb, dev);
-- if (block_cb) {
-- flow_block_cb_incref(block_cb);
-- return 0;
-+ if (!block_cb) {
-+ block_cb = flow_block_cb_alloc(cb, dev, dev, NULL);
-+ if (IS_ERR(block_cb))
-+ return PTR_ERR(block_cb);
-+
-+ register_block = true;
- }
-- block_cb = flow_block_cb_alloc(cb, dev, dev, NULL);
-- if (IS_ERR(block_cb))
-- return PTR_ERR(block_cb);
-
-- flow_block_cb_add(block_cb, f);
-- list_add_tail(&block_cb->driver_list, &block_cb_list);
+ flow_block_cb_incref(block_cb);
-+
-+ if (register_block) {
-+ flow_block_cb_add(block_cb, f);
-+ list_add_tail(&block_cb->driver_list, &block_cb_list);
-+ }
+ flow_block_cb_add(block_cb, f);
+ list_add_tail(&block_cb->driver_list, &block_cb_list);
return 0;
- case FLOW_BLOCK_UNBIND:
- block_cb = flow_block_cb_lookup(f->block, cb, dev);
+@@ -591,7 +592,7 @@ mtk_eth_setup_tc_block(struct net_device
if (!block_cb)
return -ENOENT;