Skip to contentSkip to conversation

cxgb4: Fix missing error code in cxgb4_port_mirror_alloc()

PATCH In review Jiapeng Chong 2 participants 2 messages Oct 27, 2023

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

PATCH 1/1 cxgb4: Fix missing error code in cxgb4_port_mirror_alloc()

The error code is missing in this code scenario, add the error code '-EINVAL' to the return value 'ret'.

drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:1525 cxgb4_port_mirror_alloc() warn: missing error code 'ret'.

---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +1 -0
index 2eb33a727bba..e59e199184f4 100644
@@ -1522,6 +1522,7 @@ int cxgb4_port_mirror_alloc(struct net_device *dev)
 	mutex_lock(&pi->vi_mirror_mutex);
 	if (pi->viid_mirror) {
 		pi->vi_mirror_count++;
+		ret = -EINVAL;
 		goto out_unlock;
 	}
 
Signature · 1 line
2.20.1.7.g153144c
#1 lore raw
Quoted 17 lines · Jiapeng Chong

The error code is missing in this code scenario, add the error code '-EINVAL' to the return value 'ret'.

drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:1525 cxgb4_port_mirror_alloc() warn: missing error code 'ret'.

---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +0 -0
index 2eb33a727bba..e59e199184f4 100644

drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c int cxgb4_port_mirror_alloc(struct net_device *dev) · line 1525

Quoted 4 lines
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +1 -0
@@ -1522,6 +1522,7 @@ int cxgb4_port_mirror_alloc(struct net_device *dev)
 	mutex_lock(&pi->vi_mirror_mutex);
 	if (pi->viid_mirror) {
 		pi->vi_mirror_count++;
+		ret = -EINVAL;

I'm not sure we should return error here. This looks like we're adding a new subscriber to the mirror action so the function should return 0 (ret is initialized to 0). viid_mirror exists, we're just incrementing the count of its users.

Quoted 3 lines
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +0 -0
 		goto out_unlock;
 	}