Skip to contentSkip to conversation

fm10k:Fix error handling in the function fm10k_setup_tc

PATCH In review Nicholas Krause 4 participants 5 messages Oct 20, 2015 – Oct 27, 2015

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

PATCH 1/1 fm10k:Fix error handling in the function fm10k_setup_tc

This fixes error handling in the function fm10k_setup_tc to properly check if the call to the function fm10k_open has failed by returning a error and if so return immediately to the caller of the function fm10k_setup_tc to properly signal this non recoverable failure.

---
 drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +4 -1
index 99228bf..5a4e702 100644
@@ -1146,6 +1146,7 @@ static struct rtnl_link_stats64 *fm10k_get_stats64(struct net_device *netdev,
 int fm10k_setup_tc(struct net_device *dev, u8 tc)
 {
 	struct fm10k_intfc *interface = netdev_priv(dev);
+	int err;
 
 	/* Currently only the PF supports priority classes */
 	if (tc && (interface->hw.mac.type != fm10k_mac_pf))
@@ -1175,7 +1176,9 @@ int fm10k_setup_tc(struct net_device *dev, u8 tc)
 	fm10k_mbx_request_irq(interface);
 
 	if (netif_running(dev))
-		fm10k_open(dev);
+		err = fm10k_open(dev);
+	if (err)
+		return err;
 
 	/* flag to indicate SWPRI has yet to be updated */
 	interface->flags |= FM10K_FLAG_SWPRI_CONFIG;
Signature · 1 line
2.1.4
#1 lore raw
Quoted 9 lines · Nicholas Krause

This fixes error handling in the function fm10k_setup_tc to properly check if the call to the function fm10k_open has failed by returning a error and if so return immediately to the caller of the function fm10k_setup_tc to properly signal this non recoverable failure.

---
 drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Is this a version 2 of your original patch you sent out with the same
title and patch description? It is difficult to understand the reason
for the change without a sufficient changelog (i.e. why the new version
of the patch).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20151020/088641b5/attachment.asc>

#2 lore raw
In reply to Nicholas Krause
Quoted 23 lines · Nicholas Krause

This fixes error handling in the function fm10k_setup_tc to properly check if the call to the function fm10k_open has failed by returning a error and if so return immediately to the caller of the function fm10k_setup_tc to properly signal this non recoverable failure.

---
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 5 ++++-

1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +1 -0
index 99228bf..5a4e702 100644
@@ -1146,6 +1146,7 @@ static struct rtnl_link_stats64 *fm10k_get_stats64(struct net_device *netdev,
 int fm10k_setup_tc(struct net_device *dev, u8 tc)
 {
 	struct fm10k_intfc *interface = netdev_priv(dev);
+	int err;
 
 	/* Currently only the PF supports priority classes */
 	if (tc && (interface->hw.mac.type != fm10k_mac_pf))

drivers/net/ethernet/intel/fm10k/fm10k_netdev.c int fm10k_setup_tc(struct net_device *dev, u8 tc) · line 1184

Quoted 10 lines
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +3 -1
@@ -1175,7 +1176,9 @@ int fm10k_setup_tc(struct net_device *dev, u8 tc)
 	fm10k_mbx_request_irq(interface);
 
 	if (netif_running(dev))
-		fm10k_open(dev);
+		err = fm10k_open(dev);
+	if (err)
+		return err;
 
 	/* flag to indicate SWPRI has yet to be updated */
 	interface->flags |= FM10K_FLAG_SWPRI_CONFIG;

NAK. This will reference an uninitialized err variable when netif_running returns false. The compiler should complain about this, suggesting that it wasn't compiled.

--
Mark Rustad, Networking Division, Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20151020/15318154/attachment-0001.asc>

#3 lore raw

PATCH 1/1 fm10k:Fix error handling in the function fm10k_setup_tc

Quoted 36 lines · Mark D

Review

Quoted 11 lines · Nicholas Krause

This fixes error handling in the function fm10k_setup_tc to properly check if the call to the function fm10k_open has failed by returning a error and if so return immediately to the caller of the function fm10k_setup_tc to properly signal this non recoverable failure.

---
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 5 ++++-

1 file changed, 4 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c

drivers/net/ethernet/intel/fm10k/fm10k_netdev.c static struct rtnl_link_stats64

Quoted 4 lines

index 99228bf..5a4e702 100644

drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +0 -0
@@ -1146,6 +1146,7 @@ static struct rtnl_link_stats64

*fm10k_get_stats64(struct net_device *netdev,

drivers/net/ethernet/intel/fm10k/fm10k_netdev.c int fm10k_setup_tc(struct net_device *dev, u8

Quoted 8 lines
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +1 -0
 int fm10k_setup_tc(struct net_device *dev, u8 tc)
 {
 	struct fm10k_intfc *interface = netdev_priv(dev);
+	int err;
 
 	/* Currently only the PF supports priority classes */
 	if (tc && (interface->hw.mac.type != fm10k_mac_pf))
@@ -1175,7 +1176,9 @@ int fm10k_setup_tc(struct net_device *dev, u8

tc)

Quoted 8 lines
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +3 -1
 	fm10k_mbx_request_irq(interface);
 
 	if (netif_running(dev))
-		fm10k_open(dev);
+		err = fm10k_open(dev);
+	if (err)
+		return err;
 
Quoted 8 lines

drivers/net/ethernet/intel/fm10k/fm10k_netdev.c int fm10k_setup_tc(struct net_device *dev, u8 tc) · line 1184

Quoted 2 lines
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +0 -0
 	/* flag to indicate SWPRI has yet to be updated */
 	interface->flags |= FM10K_FLAG_SWPRI_CONFIG;

NAK. This will reference an uninitialized err variable when netif_running returns false. The compiler should complain about this, suggesting that it wasn't compiled.

--

I compiled it but my compiler builds it fine. However this is a valid complaint that I don't mind fixing if there are no other complaints about the patch content. Nick

Quoted 1 line

Mark Rustad, Networking Division, Intel Corporation

Tested-by on v1 1/1
#4 lore raw
In reply to Nicholas Krause

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Nicholas Krause
Sent: Tuesday, October 20, 2015 2:05 PM
To: Kirsher, Jeffrey T <[email protected]>
Cc: linux-kernel at vger.kernel.org; intel-wired-lan at lists.osuosl.org; netdev at vger.kernel.org
Subject: [Intel-wired-lan] [PATCH] fm10k:Fix error handling in the function fm10k_setup_tc

This fixes error handling in the function fm10k_setup_tc to properly check if the call to the function fm10k_open has failed by returning a error and if so return immediately to the caller of the function fm10k_setup_tc to properly signal this non recoverable failure.

---