diff mbox

[PATCHv2,1/1] IB/ipoib: Remove unnecessary returned value check

Message ID 1483606568-17232-1-git-send-email-yanjun.zhu@oracle.com (mailing list archive)
State Accepted
Headers show

Commit Message

Zhu Yanjun Jan. 5, 2017, 8:56 a.m. UTC
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.

Reviewed-by: Guanglei Li <guanglei.li@oracle.com>
Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
---
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(-)

Comments

Yuval Shaia Jan. 5, 2017, 9:08 a.m. UTC | #1
On Thu, Jan 05, 2017 at 03:56:08AM -0500, Zhu Yanjun wrote:
> 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.
> 
> Reviewed-by: Guanglei Li <guanglei.li@oracle.com>
> Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
> ---
> 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(-)
> 
> diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
> index da12717..f568064 100644
> --- a/drivers/infiniband/ulp/ipoib/ipoib.h
> +++ b/drivers/infiniband/ulp/ipoib/ipoib.h
> @@ -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
> diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
> index 3ce0765..4e8e11e 100644
> --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
> +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
> @@ -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
> diff --git a/drivers/infiniband/ulp/ipoib/ipoib_vlan.c b/drivers/infiniband/ulp/ipoib/ipoib_vlan.c
> index a2f9f29..0c2988d 100644
> --- a/drivers/infiniband/ulp/ipoib/ipoib_vlan.c
> +++ b/drivers/infiniband/ulp/ipoib/ipoib_vlan.c
> @@ -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;

Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>

>  
> -- 
> 2.7.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> 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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Leon Romanovsky Jan. 5, 2017, 12:50 p.m. UTC | #2
On Thu, Jan 05, 2017 at 03:56:08AM -0500, Zhu Yanjun wrote:
> 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.
>
> Reviewed-by: Guanglei Li <guanglei.li@oracle.com>
> Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
> ---

Thanks,
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Doug Ledford Jan. 24, 2017, 9:35 p.m. UTC | #3
On Thu, 2017-01-05 at 14:50 +0200, Leon Romanovsky wrote:
> On Thu, Jan 05, 2017 at 03:56:08AM -0500, Zhu Yanjun wrote:
> > 
> > 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.
> > 
> > Reviewed-by: Guanglei Li <guanglei.li@oracle.com>
> > Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
> > ---
> 
> Thanks,
> Reviewed-by: Leon Romanovsky <leonro@mellanox.com>

Thanks, applied to -next area.
diff mbox

Patch

diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
index da12717..f568064 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib.h
+++ b/drivers/infiniband/ulp/ipoib/ipoib.h
@@ -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
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 3ce0765..4e8e11e 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -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
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_vlan.c b/drivers/infiniband/ulp/ipoib/ipoib_vlan.c
index a2f9f29..0c2988d 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_vlan.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_vlan.c
@@ -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;