Skip to contentSkip to conversation

net: microchip: sparx5: remove useless code in sparx5_qos_init()

PATCH In review Lu Wei 3 participants 5 messages Nov 17, 2022 – Nov 18, 2022

Subsystems (3)
lore
Share & tools
lore

Lu Wei

author
#0 lore raw

PATCH 1/1 net: microchip: sparx5: remove useless code in sparx5_qos_init()

There is no need to define variable ret, so remove it and return sparx5_leak_groups_init() directly.

---
 drivers/net/ethernet/microchip/sparx5/sparx5_qos.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/net/ethernet/microchip/sparx5/sparx5_qos.c +1 -7
index 1e79d0ef0cb8..2f39300d52cc 100644
@@ -383,13 +383,7 @@ static int sparx5_leak_groups_init(struct sparx5 *sparx5)
 
 int sparx5_qos_init(struct sparx5 *sparx5)
 {
-	int ret;
-
-	ret = sparx5_leak_groups_init(sparx5);
-	if (ret < 0)
-		return ret;
-
-	return 0;
+	return sparx5_leak_groups_init(sparx5);
 }
 
 int sparx5_tc_mqprio_add(struct net_device *ndev, u8 num_tc)
Signature · 1 line
2.31.1
#1 lore raw
Quoted 15 lines · Lu Wei

There is no need to define variable ret, so remove it and return sparx5_leak_groups_init() directly.

---
 drivers/net/ethernet/microchip/sparx5/sparx5_qos.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/net/ethernet/microchip/sparx5/sparx5_qos.c +0 -0
index 1e79d0ef0cb8..2f39300d52cc 100644
@@ -383,13 +383,7 @@ static int sparx5_leak_groups_init(struct sparx5 *sparx5)
 
 int sparx5_qos_init(struct sparx5 *sparx5)

drivers/net/ethernet/microchip/sparx5/sparx5_qos.c static int sparx5_leak_groups_init(struct sparx5 *sparx5) · line 387

Quoted 10 lines
drivers/net/ethernet/microchip/sparx5/sparx5_qos.c +1 -7
 {
-	int ret;
-
-	ret = sparx5_leak_groups_init(sparx5);
-	if (ret < 0)
-		return ret;
-
-	return 0;
+	return sparx5_leak_groups_init(sparx5);
 }

Does sparx5_qos_init() even make sense given that all it does it call a function?

Please don't do the minimum needed to make your robot happy. Think about the code, the change, is this the best fix?

Andrew

#2 lore raw
In reply to Lu Wei

Den Thu, Nov 17, 2022 at 10:58:20PM +0800 skrev Lu Wei:

Quoted 30 lines

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

There is no need to define variable ret, so remove it and return sparx5_leak_groups_init() directly.

---
 drivers/net/ethernet/microchip/sparx5/sparx5_qos.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/net/ethernet/microchip/sparx5/sparx5_qos.c +1 -8
index 1e79d0ef0cb8..2f39300d52cc 100644
@@ -383,13 +383,7 @@ static int sparx5_leak_groups_init(struct sparx5 *sparx5)
 
 int sparx5_qos_init(struct sparx5 *sparx5)
 {
-       int ret;
-
-       ret = sparx5_leak_groups_init(sparx5);
-       if (ret < 0)
-               return ret;
-
-       return 0;
+       return sparx5_leak_groups_init(sparx5);
 }
 
 int sparx5_tc_mqprio_add(struct net_device *ndev, u8 num_tc)
--
Quoted 2 lines

2.31.1

sparx5_qos_init() will be expanded in later patch series, as new QoS features require new initializations - so this is actually somewhat intentional.

/ Daniel

#3 lore raw
Quoted 3 lines

sparx5_qos_init() will be expanded in later patch series, as new QoS features require new initializations - so this is actually somewhat intentional.

When do you expect such patches to land?

If it going to be soon, we can keep the code as it is. If it is going to be a while, the bots are going to keep finding this and what to remove it.

Andrew

#4 lore raw

Den Thu, Nov 17, 2022 at 09:14:38PM +0100 skrev Andrew Lunn:

Quoted 7 lines

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Quoted 3 lines

sparx5_qos_init() will be expanded in later patch series, as new QoS features require new initializations - so this is actually somewhat intentional.

When do you expect such patches to land?

Most likely sometime in the next window.

Quoted 4 lines

If it going to be soon, we can keep the code as it is. If it is going to be a while, the bots are going to keep finding this and what to remove it.

I see. If bots will be bugging us regularly, then it might just be best to let the patch through.

Quoted 2 lines

Andrew

/ Daniel