Skip to contentSkip to conversation

fm10k:Fix error handling in the function fm10k_setup_tc

PATCH New Nicholas Krause 1 participant 1 message Oct 17, 2015

Subsystems (2)
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 calls to the functions fm10k_mbx_request or fm10k_init_queueing_scheme fail by returning a error code and if so return the error code returned by these functions immediately to the call of fm10k_setup_tc to signal a failure has occurred when called this particular function.

---
 drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c +8 -3
index 99228bf..c5469af 100644
@@ -1146,7 +1146,8 @@ 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))
 		return -EINVAL;
@@ -1170,9 +1171,13 @@ int fm10k_setup_tc(struct net_device *dev, u8 tc)
 	netdev_reset_tc(dev);
 	netdev_set_num_tc(dev, tc);
 
-	fm10k_init_queueing_scheme(interface);
+	err = fm10k_init_queueing_scheme(interface);
+	if (err)
+		return err;
 
-	fm10k_mbx_request_irq(interface);
+	err = fm10k_mbx_request_irq(interface);
+	if (err)
+		return err;
 
 	if (netif_running(dev))
 		fm10k_open(dev);
Signature · 1 line
2.1.4