All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] IB/mlx5: fix error code in get_port_caps()
@ 2015-01-12  8:14 ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2015-01-12  8:14 UTC (permalink / raw)
  To: Eli Cohen
  Cc: Roland Dreier, Sean Hefty, Hal Rosenstock, linux-rdma, kernel-janitors

We should return -ENOMEM on allocation failure instead of success.

Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB adapters')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 8a87404..cc4ac1e 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -997,7 +997,7 @@ static int get_port_caps(struct mlx5_ib_dev *dev)
 	struct ib_device_attr *dprops = NULL;
 	struct ib_port_attr *pprops = NULL;
 	struct mlx5_general_caps *gen;
-	int err = 0;
+	int err = -ENOMEM;
 	int port;
 
 	gen = &dev->mdev->caps.gen;

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [patch] IB/mlx5: fix error code in get_port_caps()
@ 2015-01-12  8:14 ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2015-01-12  8:14 UTC (permalink / raw)
  To: Eli Cohen
  Cc: Roland Dreier, Sean Hefty, Hal Rosenstock, linux-rdma, kernel-janitors

We should return -ENOMEM on allocation failure instead of success.

Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB adapters')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 8a87404..cc4ac1e 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -997,7 +997,7 @@ static int get_port_caps(struct mlx5_ib_dev *dev)
 	struct ib_device_attr *dprops = NULL;
 	struct ib_port_attr *pprops = NULL;
 	struct mlx5_general_caps *gen;
-	int err = 0;
+	int err = -ENOMEM;
 	int port;
 
 	gen = &dev->mdev->caps.gen;

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [patch] IB/mlx5: fix error code in get_port_caps()
  2015-01-12  8:14 ` Dan Carpenter
@ 2015-01-12  8:35   ` Julia Lawall
  -1 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2015-01-12  8:35 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Eli Cohen, Roland Dreier, Sean Hefty, Hal Rosenstock,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

On Mon, 12 Jan 2015, Dan Carpenter wrote:

> We should return -ENOMEM on allocation failure instead of success.

Probably not a big deal, but the commit message is not clear at all.  From
the fix, it doesn't look like the code was returning -ENOMEM on success.

julia

> Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB adapters')
> Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
>
> diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
> index 8a87404..cc4ac1e 100644
> --- a/drivers/infiniband/hw/mlx5/main.c
> +++ b/drivers/infiniband/hw/mlx5/main.c
> @@ -997,7 +997,7 @@ static int get_port_caps(struct mlx5_ib_dev *dev)
>  	struct ib_device_attr *dprops = NULL;
>  	struct ib_port_attr *pprops = NULL;
>  	struct mlx5_general_caps *gen;
> -	int err = 0;
> +	int err = -ENOMEM;
>  	int port;
>
>  	gen = &dev->mdev->caps.gen;
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] IB/mlx5: fix error code in get_port_caps()
@ 2015-01-12  8:35   ` Julia Lawall
  0 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2015-01-12  8:35 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Eli Cohen, Roland Dreier, Sean Hefty, Hal Rosenstock,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

On Mon, 12 Jan 2015, Dan Carpenter wrote:

> We should return -ENOMEM on allocation failure instead of success.

Probably not a big deal, but the commit message is not clear at all.  From
the fix, it doesn't look like the code was returning -ENOMEM on success.

julia

> Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB adapters')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
> index 8a87404..cc4ac1e 100644
> --- a/drivers/infiniband/hw/mlx5/main.c
> +++ b/drivers/infiniband/hw/mlx5/main.c
> @@ -997,7 +997,7 @@ static int get_port_caps(struct mlx5_ib_dev *dev)
>  	struct ib_device_attr *dprops = NULL;
>  	struct ib_port_attr *pprops = NULL;
>  	struct mlx5_general_caps *gen;
> -	int err = 0;
> +	int err = -ENOMEM;
>  	int port;
>
>  	gen = &dev->mdev->caps.gen;
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] IB/mlx5: fix error code in get_port_caps()
  2015-01-12  8:14 ` Dan Carpenter
@ 2015-01-12  8:54   ` Eli Cohen
  -1 siblings, 0 replies; 8+ messages in thread
From: Eli Cohen @ 2015-01-12  8:54 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Roland Dreier, Sean Hefty, Hal Rosenstock, linux-rdma, kernel-janitors

Acked-by: Eli Cohen <eli@mellanox.com>

Thanks!

On Mon, Jan 12, 2015 at 11:14:29AM +0300, Dan Carpenter wrote:
> We should return -ENOMEM on allocation failure instead of success.
> 
> Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB adapters')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
> index 8a87404..cc4ac1e 100644
> --- a/drivers/infiniband/hw/mlx5/main.c
> +++ b/drivers/infiniband/hw/mlx5/main.c
> @@ -997,7 +997,7 @@ static int get_port_caps(struct mlx5_ib_dev *dev)
>  	struct ib_device_attr *dprops = NULL;
>  	struct ib_port_attr *pprops = NULL;
>  	struct mlx5_general_caps *gen;
> -	int err = 0;
> +	int err = -ENOMEM;
>  	int port;
>  
>  	gen = &dev->mdev->caps.gen;
> --
> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] IB/mlx5: fix error code in get_port_caps()
@ 2015-01-12  8:54   ` Eli Cohen
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Cohen @ 2015-01-12  8:54 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Roland Dreier, Sean Hefty, Hal Rosenstock, linux-rdma, kernel-janitors

Acked-by: Eli Cohen <eli@mellanox.com>

Thanks!

On Mon, Jan 12, 2015 at 11:14:29AM +0300, Dan Carpenter wrote:
> We should return -ENOMEM on allocation failure instead of success.
> 
> Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB adapters')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
> index 8a87404..cc4ac1e 100644
> --- a/drivers/infiniband/hw/mlx5/main.c
> +++ b/drivers/infiniband/hw/mlx5/main.c
> @@ -997,7 +997,7 @@ static int get_port_caps(struct mlx5_ib_dev *dev)
>  	struct ib_device_attr *dprops = NULL;
>  	struct ib_port_attr *pprops = NULL;
>  	struct mlx5_general_caps *gen;
> -	int err = 0;
> +	int err = -ENOMEM;
>  	int port;
>  
>  	gen = &dev->mdev->caps.gen;
> --
> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [patch v2] IB/mlx5: fix error code in get_port_caps()
  2015-01-12  8:35   ` Julia Lawall
@ 2015-01-12  8:56     ` Dan Carpenter
  -1 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2015-01-12  8:56 UTC (permalink / raw)
  To: Eli Cohen
  Cc: Roland Dreier, Sean Hefty, Hal Rosenstock, linux-rdma, kernel-janitors

The current code returns success when kmalloc() fails.  It should return
an error code, -ENOMEM.

Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB adapters')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: re-write changelog

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 8a87404..cc4ac1e 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -997,7 +997,7 @@ static int get_port_caps(struct mlx5_ib_dev *dev)
 	struct ib_device_attr *dprops = NULL;
 	struct ib_port_attr *pprops = NULL;
 	struct mlx5_general_caps *gen;
-	int err = 0;
+	int err = -ENOMEM;
 	int port;
 
 	gen = &dev->mdev->caps.gen;

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [patch v2] IB/mlx5: fix error code in get_port_caps()
@ 2015-01-12  8:56     ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2015-01-12  8:56 UTC (permalink / raw)
  To: Eli Cohen
  Cc: Roland Dreier, Sean Hefty, Hal Rosenstock, linux-rdma, kernel-janitors

The current code returns success when kmalloc() fails.  It should return
an error code, -ENOMEM.

Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB adapters')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: re-write changelog

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 8a87404..cc4ac1e 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -997,7 +997,7 @@ static int get_port_caps(struct mlx5_ib_dev *dev)
 	struct ib_device_attr *dprops = NULL;
 	struct ib_port_attr *pprops = NULL;
 	struct mlx5_general_caps *gen;
-	int err = 0;
+	int err = -ENOMEM;
 	int port;
 
 	gen = &dev->mdev->caps.gen;

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-01-12  8:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-12  8:14 [patch] IB/mlx5: fix error code in get_port_caps() Dan Carpenter
2015-01-12  8:14 ` Dan Carpenter
2015-01-12  8:35 ` Julia Lawall
2015-01-12  8:35   ` Julia Lawall
2015-01-12  8:56   ` [patch v2] " Dan Carpenter
2015-01-12  8:56     ` Dan Carpenter
2015-01-12  8:54 ` [patch] " Eli Cohen
2015-01-12  8:54   ` Eli Cohen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.