diff mbox

[rdma-next,V2,4/5] RDMA/ipoib: Fix return code from ipoib_cm_dev_init

Message ID 20180704215251.10698-5-kamalheib1@gmail.com (mailing list archive)
State Superseded
Headers show

Commit Message

Kamal Heib July 4, 2018, 9:52 p.m. UTC
The proper return code is -EOPNOTSUPP and not -ENOSYS when the function
isn't supported.

Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
---
 drivers/infiniband/ulp/ipoib/ipoib.h       | 2 +-
 drivers/infiniband/ulp/ipoib/ipoib_verbs.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Leon Romanovsky July 5, 2018, 5:24 a.m. UTC | #1
On Thu, Jul 05, 2018 at 12:52:50AM +0300, Kamal Heib wrote:
> The proper return code is -EOPNOTSUPP and not -ENOSYS when the function
> isn't supported.
>
> Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> ---
>  drivers/infiniband/ulp/ipoib/ipoib.h       | 2 +-
>  drivers/infiniband/ulp/ipoib/ipoib_verbs.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>

Thanks,
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Jason Gunthorpe July 9, 2018, 6:13 p.m. UTC | #2
On Thu, Jul 05, 2018 at 12:52:50AM +0300, Kamal Heib wrote:
> The proper return code is -EOPNOTSUPP and not -ENOSYS when the function
> isn't supported.
> 
> Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> ---
>  drivers/infiniband/ulp/ipoib/ipoib.h       | 2 +-
>  drivers/infiniband/ulp/ipoib/ipoib_verbs.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
> index 3dd130afb571..e255a7e5a4c3 100644
> --- a/drivers/infiniband/ulp/ipoib/ipoib.h
> +++ b/drivers/infiniband/ulp/ipoib/ipoib.h
> @@ -729,7 +729,7 @@ void ipoib_cm_dev_stop(struct net_device *dev)
>  static inline
>  int ipoib_cm_dev_init(struct net_device *dev)
>  {
> -	return -ENOSYS;
> +	return -EOPNOTSUPP;
>  }
>  
>  static inline
> diff --git a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
> index ba4669f24014..2872cd12bc6e 100644
> --- a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
> +++ b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
> @@ -168,7 +168,7 @@ int ipoib_transport_dev_init(struct net_device *dev, struct ib_device *ca)
>  		else
>  			size += ipoib_recvq_size * ipoib_max_conn_qp;
>  	} else
> -		if (ret != -ENOSYS)
> +		if (ret != -EOPNOTSUPP)
>  			return -ENODEV;

This is so weird, why does it eat the return code? It doesn't really
matter, but lets write this kind of stuff sanely at least:

@@ -168,8 +168,8 @@ int ipoib_transport_dev_init(struct net_device *dev, struct ib_device *ca)
                else
                        size += ipoib_recvq_size * ipoib_max_conn_qp;
        } else
-               if (ret != -ENOSYS)
-                       return -ENODEV;
+               if (ret != -EOPNOTSUPP)
+                       return ret;

        req_vec = (priv->port - 1) * 2;
 
Yes?

Jason
--
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
Kamal Heib July 9, 2018, 7:02 p.m. UTC | #3
On Mon, Jul 09, 2018 at 12:13:32PM -0600, Jason Gunthorpe wrote:
> On Thu, Jul 05, 2018 at 12:52:50AM +0300, Kamal Heib wrote:
> > The proper return code is -EOPNOTSUPP and not -ENOSYS when the function
> > isn't supported.
> > 
> > Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> > ---
> >  drivers/infiniband/ulp/ipoib/ipoib.h       | 2 +-
> >  drivers/infiniband/ulp/ipoib/ipoib_verbs.c | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
> > index 3dd130afb571..e255a7e5a4c3 100644
> > --- a/drivers/infiniband/ulp/ipoib/ipoib.h
> > +++ b/drivers/infiniband/ulp/ipoib/ipoib.h
> > @@ -729,7 +729,7 @@ void ipoib_cm_dev_stop(struct net_device *dev)
> >  static inline
> >  int ipoib_cm_dev_init(struct net_device *dev)
> >  {
> > -	return -ENOSYS;
> > +	return -EOPNOTSUPP;
> >  }
> >  
> >  static inline
> > diff --git a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
> > index ba4669f24014..2872cd12bc6e 100644
> > --- a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
> > +++ b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
> > @@ -168,7 +168,7 @@ int ipoib_transport_dev_init(struct net_device *dev, struct ib_device *ca)
> >  		else
> >  			size += ipoib_recvq_size * ipoib_max_conn_qp;
> >  	} else
> > -		if (ret != -ENOSYS)
> > +		if (ret != -EOPNOTSUPP)
> >  			return -ENODEV;
> 
> This is so weird, why does it eat the return code? It doesn't really
> matter, but lets write this kind of stuff sanely at least:
> 
> @@ -168,8 +168,8 @@ int ipoib_transport_dev_init(struct net_device *dev, struct ib_device *ca)
>                 else
>                         size += ipoib_recvq_size * ipoib_max_conn_qp;
>         } else
> -               if (ret != -ENOSYS)
> -                       return -ENODEV;
> +               if (ret != -EOPNOTSUPP)
> +                       return ret;
> 
>         req_vec = (priv->port - 1) * 2;
>  
> Yes?
ACK, I'll send v3 soon.

Thanks,
Kamal
> 
> Jason
--
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
diff mbox

Patch

diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
index 3dd130afb571..e255a7e5a4c3 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib.h
+++ b/drivers/infiniband/ulp/ipoib/ipoib.h
@@ -729,7 +729,7 @@  void ipoib_cm_dev_stop(struct net_device *dev)
 static inline
 int ipoib_cm_dev_init(struct net_device *dev)
 {
-	return -ENOSYS;
+	return -EOPNOTSUPP;
 }
 
 static inline
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
index ba4669f24014..2872cd12bc6e 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
@@ -168,7 +168,7 @@  int ipoib_transport_dev_init(struct net_device *dev, struct ib_device *ca)
 		else
 			size += ipoib_recvq_size * ipoib_max_conn_qp;
 	} else
-		if (ret != -ENOSYS)
+		if (ret != -EOPNOTSUPP)
 			return -ENODEV;
 
 	req_vec = (priv->port - 1) * 2;