Skip to contentSkip to conversation

IB/ipoib: Remove unnecessary returned value check

PATCH Applied Yanjun Zhu 4 participants 8 messages Jan 5, 2017 – Jan 24, 2017 6 messages not in the archive InfiniBand

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 1483522018-4669-1-git-send-email-yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org

Yanjun Zhu

author
#2 lore raw

Hi, Yuval Shaia && Leon Romanovsky && Maintainers

Follow your advice, a new patch is made. Please check it.

Thanks a lot.
Zhu Yanjun

Quoted 67 lines · Zhu Yanjun

In the function ipoib_set_dev_features, the returned value is always 0. As such, it is not necessary to check the returned value. This is not a bug. It is a trivial problem.

---
Change from v1 to v2:
make change to __ipoib_vlan_add.
change the commit header.

  drivers/infiniband/ulp/ipoib/ipoib.h      | 2 +-
  drivers/infiniband/ulp/ipoib/ipoib_main.c | 8 ++------
  drivers/infiniband/ulp/ipoib/ipoib_vlan.c | 4 +---
  3 files changed, 4 insertions(+), 10 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib.h +1 -1
index da12717..f568064 100644
@@ -593,7 +593,7 @@ void ipoib_pkey_open(struct ipoib_dev_priv *priv);
  void ipoib_drain_cq(struct net_device *dev);
 
  void ipoib_set_ethtool_ops(struct net_device *dev);
-int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca);
+void ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca);
 
  #define IPOIB_FLAGS_RC		0x80
  #define IPOIB_FLAGS_UC		0x40
drivers/infiniband/ulp/ipoib/ipoib_main.c +2 -6
index 3ce0765..4e8e11e 100644
@@ -1984,7 +1984,7 @@ int ipoib_add_pkey_attr(struct net_device *dev)
  	return device_create_file(&dev->dev, &dev_attr_pkey);
  }
 
-int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
+void ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
  {
  	priv->hca_caps = hca->attrs.device_cap_flags;
 
@@ -1996,8 +1996,6 @@ int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
 
  		priv->dev->features |= priv->dev->hw_features;
  	}
-
-	return 0;
  }
 
  static struct net_device *ipoib_add_port(const char *format,
@@ -2037,9 +2035,7 @@ static struct net_device *ipoib_add_port(const char *format,
  		goto device_init_failed;
  	}
 
-	result = ipoib_set_dev_features(priv, hca);
-	if (result)
-		goto device_init_failed;
+	ipoib_set_dev_features(priv, hca);
 
  	/*
  	 * Set the full membership bit, so that we join the right
drivers/infiniband/ulp/ipoib/ipoib_vlan.c +0 -0
index a2f9f29..0c2988d 100644

drivers/infiniband/ulp/ipoib/ipoib_vlan.c int __ipoib_vlan_add(struct ipoib_dev_priv *ppriv, struct ipoib_dev_priv *priv, · line 67

Quoted 10 lines
drivers/infiniband/ulp/ipoib/ipoib_vlan.c +1 -3
@@ -61,9 +61,7 @@ int __ipoib_vlan_add(struct ipoib_dev_priv *ppriv, struct ipoib_dev_priv *priv,
  	priv->parent = ppriv->dev;
  	set_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags);
 
-	result = ipoib_set_dev_features(priv, ppriv->ca);
-	if (result)
-		goto err;
+	ipoib_set_dev_features(priv, ppriv->ca);
 
  	priv->pkey = pkey;
 

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Hi Zhu Yanjun,
Patch looks fine.

However, the way it is posted makes it hard (maybe impossible) to apply. Suggesting to repost using git send-email.

Yuval

Quoted 71 lines · Yanjun Zhu

Hi, Yuval Shaia && Leon Romanovsky && Maintainers

Follow your advice, a new patch is made. Please check it.

Thanks a lot.
Zhu Yanjun

Quoted 63 lines · Zhu Yanjun

In the function ipoib_set_dev_features, the returned value is always 0. As such, it is not necessary to check the returned value. This is not a bug. It is a trivial problem.

---
Change from v1 to v2:
make change to __ipoib_vlan_add.
change the commit header.

 drivers/infiniband/ulp/ipoib/ipoib.h      | 2 +-
 drivers/infiniband/ulp/ipoib/ipoib_main.c | 8 ++------
 drivers/infiniband/ulp/ipoib/ipoib_vlan.c | 4 +---
 3 files changed, 4 insertions(+), 10 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib.h +1 -1
index da12717..f568064 100644
@@ -593,7 +593,7 @@ void ipoib_pkey_open(struct ipoib_dev_priv *priv);
 void ipoib_drain_cq(struct net_device *dev);
 void ipoib_set_ethtool_ops(struct net_device *dev);
-int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca);
+void ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca);
 #define IPOIB_FLAGS_RC		0x80
 #define IPOIB_FLAGS_UC		0x40
drivers/infiniband/ulp/ipoib/ipoib_main.c +2 -6
index 3ce0765..4e8e11e 100644
@@ -1984,7 +1984,7 @@ int ipoib_add_pkey_attr(struct net_device *dev)
 	return device_create_file(&dev->dev, &dev_attr_pkey);
 }
-int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
+void ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
 {
 	priv->hca_caps = hca->attrs.device_cap_flags;
@@ -1996,8 +1996,6 @@ int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
 		priv->dev->features |= priv->dev->hw_features;
 	}
-
-	return 0;
 }
 static struct net_device *ipoib_add_port(const char *format,
@@ -2037,9 +2035,7 @@ static struct net_device *ipoib_add_port(const char *format,
 		goto device_init_failed;
 	}
-	result = ipoib_set_dev_features(priv, hca);
-	if (result)
-		goto device_init_failed;
+	ipoib_set_dev_features(priv, hca);
 	/*
 	 * Set the full membership bit, so that we join the right
drivers/infiniband/ulp/ipoib/ipoib_vlan.c +0 -2
index a2f9f29..0c2988d 100644
@@ -61,9 +61,7 @@ int __ipoib_vlan_add(struct ipoib_dev_priv *ppriv, struct ipoib_dev_priv *priv,
 	priv->parent = ppriv->dev;
 	set_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags);
-	result = ipoib_set_dev_features(priv, ppriv->ca);
-	if (result)
Quoted 8 lines

drivers/infiniband/ulp/ipoib/ipoib_vlan.c int __ipoib_vlan_add(struct ipoib_dev_priv *ppriv, struct ipoib_dev_priv *priv, · line 64

Quoted 3 lines
drivers/infiniband/ulp/ipoib/ipoib_vlan.c +1 -1
-		goto err;
+	ipoib_set_dev_features(priv, ppriv->ca);
 	priv->pkey = pkey;

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#5 lore raw

Sorry. My bad. I resend it now.

Zhu Yanjun

Quoted 87 lines · Yuval Shaia

Hi Zhu Yanjun,
Patch looks fine.

However, the way it is posted makes it hard (maybe impossible) to apply. Suggesting to repost using git send-email.

Yuval

Quoted 70 lines · Yanjun Zhu

Hi, Yuval Shaia && Leon Romanovsky && Maintainers

Follow your advice, a new patch is made. Please check it.

Thanks a lot.
Zhu Yanjun

Quoted 62 lines · Zhu Yanjun

In the function ipoib_set_dev_features, the returned value is always 0. As such, it is not necessary to check the returned value. This is not a bug. It is a trivial problem.

---
Change from v1 to v2:
make change to __ipoib_vlan_add.
change the commit header.

  drivers/infiniband/ulp/ipoib/ipoib.h      | 2 +-
  drivers/infiniband/ulp/ipoib/ipoib_main.c | 8 ++------
  drivers/infiniband/ulp/ipoib/ipoib_vlan.c | 4 +---
  3 files changed, 4 insertions(+), 10 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib.h +1 -1
index da12717..f568064 100644
@@ -593,7 +593,7 @@ void ipoib_pkey_open(struct ipoib_dev_priv *priv);
  void ipoib_drain_cq(struct net_device *dev);
  void ipoib_set_ethtool_ops(struct net_device *dev);
-int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca);
+void ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca);
  #define IPOIB_FLAGS_RC		0x80
  #define IPOIB_FLAGS_UC		0x40
drivers/infiniband/ulp/ipoib/ipoib_main.c +2 -6
index 3ce0765..4e8e11e 100644
@@ -1984,7 +1984,7 @@ int ipoib_add_pkey_attr(struct net_device *dev)
  	return device_create_file(&dev->dev, &dev_attr_pkey);
  }
-int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
+void ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
  {
  	priv->hca_caps = hca->attrs.device_cap_flags;
@@ -1996,8 +1996,6 @@ int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
  		priv->dev->features |= priv->dev->hw_features;
  	}
-
-	return 0;
  }
  static struct net_device *ipoib_add_port(const char *format,
@@ -2037,9 +2035,7 @@ static struct net_device *ipoib_add_port(const char *format,
  		goto device_init_failed;
  	}
-	result = ipoib_set_dev_features(priv, hca);
-	if (result)
-		goto device_init_failed;
+	ipoib_set_dev_features(priv, hca);
  	/*
  	 * Set the full membership bit, so that we join the right
drivers/infiniband/ulp/ipoib/ipoib_vlan.c +0 -1
index a2f9f29..0c2988d 100644
@@ -61,9 +61,7 @@ int __ipoib_vlan_add(struct ipoib_dev_priv *ppriv, struct ipoib_dev_priv *priv,
  	priv->parent = ppriv->dev;
  	set_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags);
-	result = ipoib_set_dev_features(priv, ppriv->ca);
Quoted 8 lines

drivers/infiniband/ulp/ipoib/ipoib_vlan.c int __ipoib_vlan_add(struct ipoib_dev_priv *ppriv, struct ipoib_dev_priv *priv, · line 64

Quoted 4 lines
drivers/infiniband/ulp/ipoib/ipoib_vlan.c +1 -2
-	if (result)
-		goto err;
+	ipoib_set_dev_features(priv, ppriv->ca);
  	priv->pkey = pkey;

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
In reply to a message not in the archive
Quoted 3 lines · Yanjun Zhu

Hi, Yuval Shaia && Leon Romanovsky && Maintainers

Follow your advice, a new patch is made. Please check it.

How are you sending it? I missed this patch and first version too. Are you sending it with git send-email?

Was your patch catched in patchworks [1]? and linux-rdma mailing list?

Please post it properly, so we will be able to review it and Doug will be able to apply it.

[1] https://patchwork.kernel.org/project/linux-rdma/list/

Thanks

Quoted 72 lines

Thanks a lot.
Zhu Yanjun

Quoted 66 lines · Zhu Yanjun

In the function ipoib_set_dev_features, the returned value is always 0. As such, it is not necessary to check the returned value. This is not a bug. It is a trivial problem.

---
Change from v1 to v2:
make change to __ipoib_vlan_add.
change the commit header.

  drivers/infiniband/ulp/ipoib/ipoib.h      | 2 +-
  drivers/infiniband/ulp/ipoib/ipoib_main.c | 8 ++------
  drivers/infiniband/ulp/ipoib/ipoib_vlan.c | 4 +---
  3 files changed, 4 insertions(+), 10 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib.h +1 -1
index da12717..f568064 100644
@@ -593,7 +593,7 @@ void ipoib_pkey_open(struct ipoib_dev_priv *priv);
  void ipoib_drain_cq(struct net_device *dev);
  void ipoib_set_ethtool_ops(struct net_device *dev);
-int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca);
+void ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca);
  #define IPOIB_FLAGS_RC		0x80
  #define IPOIB_FLAGS_UC		0x40
drivers/infiniband/ulp/ipoib/ipoib_main.c +2 -6
index 3ce0765..4e8e11e 100644
@@ -1984,7 +1984,7 @@ int ipoib_add_pkey_attr(struct net_device *dev)
  	return device_create_file(&dev->dev, &dev_attr_pkey);
  }
-int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
+void ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
  {
  	priv->hca_caps = hca->attrs.device_cap_flags;
@@ -1996,8 +1996,6 @@ int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
  		priv->dev->features |= priv->dev->hw_features;
  	}
-
-	return 0;
  }
  static struct net_device *ipoib_add_port(const char *format,
@@ -2037,9 +2035,7 @@ static struct net_device *ipoib_add_port(const char *format,
  		goto device_init_failed;
  	}
-	result = ipoib_set_dev_features(priv, hca);
-	if (result)
-		goto device_init_failed;
+	ipoib_set_dev_features(priv, hca);
  	/*
  	 * Set the full membership bit, so that we join the right
drivers/infiniband/ulp/ipoib/ipoib_vlan.c +1 -3
index a2f9f29..0c2988d 100644
@@ -61,9 +61,7 @@ int __ipoib_vlan_add(struct ipoib_dev_priv *ppriv, struct ipoib_dev_priv *priv,
  	priv->parent = ppriv->dev;
  	set_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags);
-	result = ipoib_set_dev_features(priv, ppriv->ca);
-	if (result)
-		goto err;
+	ipoib_set_dev_features(priv, ppriv->ca);
  	priv->pkey = pkey;

A message that is not in the archive (sent off-list or not yet received): 20170105061236.GV12077-U/[email protected]

author
#8 lore raw

PATCH v2 1/1 IB/ipoib: Remove unnecessary returned value check

In the function ipoib_set_dev_features, the returned value is always 0. As such, it is not necessary to check the returned value. This is not a bug. It is a trivial problem.

---
Change from v1 to v2:
make change to __ipoib_vlan_add.
change the commit header.

 drivers/infiniband/ulp/ipoib/ipoib.h      | 2 +-
 drivers/infiniband/ulp/ipoib/ipoib_main.c | 8 ++------
 drivers/infiniband/ulp/ipoib/ipoib_vlan.c | 4 +---
 3 files changed, 4 insertions(+), 10 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib.h +1 -1
index da12717..f568064 100644
@@ -593,7 +593,7 @@ void ipoib_pkey_open(struct ipoib_dev_priv *priv);
 void ipoib_drain_cq(struct net_device *dev);
 
 void ipoib_set_ethtool_ops(struct net_device *dev);
-int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca);
+void ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca);
 
 #define IPOIB_FLAGS_RC		0x80
 #define IPOIB_FLAGS_UC		0x40
drivers/infiniband/ulp/ipoib/ipoib_main.c +2 -6
index 3ce0765..4e8e11e 100644
@@ -1984,7 +1984,7 @@ int ipoib_add_pkey_attr(struct net_device *dev)
 	return device_create_file(&dev->dev, &dev_attr_pkey);
 }
 
-int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
+void ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
 {
 	priv->hca_caps = hca->attrs.device_cap_flags;
 
@@ -1996,8 +1996,6 @@ int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
 
 		priv->dev->features |= priv->dev->hw_features;
 	}
-
-	return 0;
 }
 
 static struct net_device *ipoib_add_port(const char *format,
@@ -2037,9 +2035,7 @@ static struct net_device *ipoib_add_port(const char *format,
 		goto device_init_failed;
 	}
 
-	result = ipoib_set_dev_features(priv, hca);
-	if (result)
-		goto device_init_failed;
+	ipoib_set_dev_features(priv, hca);
 
 	/*
 	 * Set the full membership bit, so that we join the right
drivers/infiniband/ulp/ipoib/ipoib_vlan.c +1 -3
index a2f9f29..0c2988d 100644
@@ -61,9 +61,7 @@ int __ipoib_vlan_add(struct ipoib_dev_priv *ppriv, struct ipoib_dev_priv *priv,
 	priv->parent = ppriv->dev;
 	set_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags);
 
-	result = ipoib_set_dev_features(priv, ppriv->ca);
-	if (result)
-		goto err;
+	ipoib_set_dev_features(priv, ppriv->ca);
 
 	priv->pkey = pkey;
 
Signature · 6 lines
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1483606568-17232-1-git-send-email-yanjun.zhu-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org

Reviewed-by
#10 lore raw
Quoted 67 lines · Zhu Yanjun

In the function ipoib_set_dev_features, the returned value is always 0. As such, it is not necessary to check the returned value. This is not a bug. It is a trivial problem.

---
Change from v1 to v2:
make change to __ipoib_vlan_add.
change the commit header.

 drivers/infiniband/ulp/ipoib/ipoib.h      | 2 +-
 drivers/infiniband/ulp/ipoib/ipoib_main.c | 8 ++------
 drivers/infiniband/ulp/ipoib/ipoib_vlan.c | 4 +---
 3 files changed, 4 insertions(+), 10 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib.h +1 -1
index da12717..f568064 100644
@@ -593,7 +593,7 @@ void ipoib_pkey_open(struct ipoib_dev_priv *priv);
 void ipoib_drain_cq(struct net_device *dev);
 
 void ipoib_set_ethtool_ops(struct net_device *dev);
-int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca);
+void ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca);
 
 #define IPOIB_FLAGS_RC		0x80
 #define IPOIB_FLAGS_UC		0x40
drivers/infiniband/ulp/ipoib/ipoib_main.c +2 -6
index 3ce0765..4e8e11e 100644
@@ -1984,7 +1984,7 @@ int ipoib_add_pkey_attr(struct net_device *dev)
 	return device_create_file(&dev->dev, &dev_attr_pkey);
 }
 
-int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
+void ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
 {
 	priv->hca_caps = hca->attrs.device_cap_flags;
 
@@ -1996,8 +1996,6 @@ int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
 
 		priv->dev->features |= priv->dev->hw_features;
 	}
-
-	return 0;
 }
 
 static struct net_device *ipoib_add_port(const char *format,
@@ -2037,9 +2035,7 @@ static struct net_device *ipoib_add_port(const char *format,
 		goto device_init_failed;
 	}
 
-	result = ipoib_set_dev_features(priv, hca);
-	if (result)
-		goto device_init_failed;
+	ipoib_set_dev_features(priv, hca);
 
 	/*
 	 * Set the full membership bit, so that we join the right
drivers/infiniband/ulp/ipoib/ipoib_vlan.c +0 -0
index a2f9f29..0c2988d 100644

drivers/infiniband/ulp/ipoib/ipoib_vlan.c int __ipoib_vlan_add(struct ipoib_dev_priv *ppriv, struct ipoib_dev_priv *priv, · line 66

Quoted 9 lines
drivers/infiniband/ulp/ipoib/ipoib_vlan.c +1 -3
@@ -61,9 +61,7 @@ int __ipoib_vlan_add(struct ipoib_dev_priv *ppriv, struct ipoib_dev_priv *priv,
 	priv->parent = ppriv->dev;
 	set_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags);
 
-	result = ipoib_set_dev_features(priv, ppriv->ca);
-	if (result)
-		goto err;
+	ipoib_set_dev_features(priv, ppriv->ca);
 
 	priv->pkey = pkey;
Quoted 8 lines
Signature · 7 lines
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20170105125022.GA15685-U/[email protected]

Applied
#13 lore raw
Quoted 7 lines · Leon Romanovsky
Quoted 6 lines · Zhu Yanjun

In the function ipoib_set_dev_features, the returned value is always 0.
As such, it is not necessary to check the returned value. This is not a bug. It is a trivial problem.

Quoted 6 lines
Quoted 3 lines

---

Thanks,

Thanks, applied to -next area.

Signature · 4 lines
Doug Ledford <[email protected]>
    GPG KeyID: B826A3330E572FDD
   
Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD