netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch -next] mlx5_core: warn if no space left in alloc_4k()
@ 2013-11-01 10:20 Dan Carpenter
       [not found] ` <20131101102044.GB29795-dZEljifmRObu9KfB+GxooP8+0UxHXcjY@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2013-11-01 10:20 UTC (permalink / raw)
  To: Eli Cohen
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

The warning was unreachable.  In the original code, it would print the
line number and the function but I have added an error message.

Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
---
I haven't tested this, hopefully the warning is not annoying.

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
index ba816c2..cb86265 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
@@ -193,8 +193,8 @@ static int alloc_4k(struct mlx5_core_dev *dev, u64 *addr)
 	unsigned n;
 
 	if (list_empty(&dev->priv.free_list)) {
+		mlx5_core_warn(dev, "no available space\n");
 		return -ENOMEM;
-		mlx5_core_warn(dev, "\n");
 	}
 
 	fp = list_entry(dev->priv.free_list.next, struct fw_page, list);
--
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 related	[flat|nested] 5+ messages in thread

* Re: [patch -next] mlx5_core: warn if no space left in alloc_4k()
       [not found] ` <20131101102044.GB29795-dZEljifmRObu9KfB+GxooP8+0UxHXcjY@public.gmane.org>
@ 2013-11-03  7:03   ` Eli Cohen
  2013-11-03 23:16     ` Dan Carpenter
  2013-11-04 22:20     ` [patch v2] mlx5_core: delete some dead code Dan Carpenter
  0 siblings, 2 replies; 5+ messages in thread
From: Eli Cohen @ 2013-11-03  7:03 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Eli Cohen, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

On Fri, Nov 01, 2013 at 01:20:44PM +0300, Dan Carpenter wrote:
> The warning was unreachable.  In the original code, it would print the
> line number and the function but I have added an error message.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> ---
> I haven't tested this, hopefully the warning is not annoying.
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
> index ba816c2..cb86265 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
> @@ -193,8 +193,8 @@ static int alloc_4k(struct mlx5_core_dev *dev, u64 *addr)
>  	unsigned n;
>  
>  	if (list_empty(&dev->priv.free_list)) {
> +		mlx5_core_warn(dev, "no available space\n");
>  		return -ENOMEM;
> -		mlx5_core_warn(dev, "\n");
>  	}

What we really need to do here is silently return -ENOMEM. The list
can be found empty on a regular basis so we don't want to flood dmesg
with annoying messages. The statement was probably left there from a
previous debug cycle.

>  
>  	fp = list_entry(dev->priv.free_list.next, struct fw_page, list);
> --
> 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
--
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] 5+ messages in thread

* Re: [patch -next] mlx5_core: warn if no space left in alloc_4k()
  2013-11-03  7:03   ` Eli Cohen
@ 2013-11-03 23:16     ` Dan Carpenter
  2013-11-04 22:20     ` [patch v2] mlx5_core: delete some dead code Dan Carpenter
  1 sibling, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2013-11-03 23:16 UTC (permalink / raw)
  To: Eli Cohen; +Cc: Eli Cohen, netdev, linux-rdma, kernel-janitors

On Sun, Nov 03, 2013 at 09:03:27AM +0200, Eli Cohen wrote:
> On Fri, Nov 01, 2013 at 01:20:44PM +0300, Dan Carpenter wrote:
> > The warning was unreachable.  In the original code, it would print the
> > line number and the function but I have added an error message.
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> > I haven't tested this, hopefully the warning is not annoying.
> > 
> > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
> > index ba816c2..cb86265 100644
> > --- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
> > @@ -193,8 +193,8 @@ static int alloc_4k(struct mlx5_core_dev *dev, u64 *addr)
> >  	unsigned n;
> >  
> >  	if (list_empty(&dev->priv.free_list)) {
> > +		mlx5_core_warn(dev, "no available space\n");
> >  		return -ENOMEM;
> > -		mlx5_core_warn(dev, "\n");
> >  	}
> 
> What we really need to do here is silently return -ENOMEM. The list
> can be found empty on a regular basis so we don't want to flood dmesg
> with annoying messages. The statement was probably left there from a
> previous debug cycle.

Ah, ok.  Thanks for the review.  I will remove the message.

regards,
dan carpenter

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

* [patch v2] mlx5_core: delete some dead code
  2013-11-03  7:03   ` Eli Cohen
  2013-11-03 23:16     ` Dan Carpenter
@ 2013-11-04 22:20     ` Dan Carpenter
  2013-11-05 20:51       ` David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2013-11-04 22:20 UTC (permalink / raw)
  To: Eli Cohen
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

The printk() looks like it is left over debug code.  I have removed it.

Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
---
v2:  Remove the printk instead of moving it infront of the return.

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
index ba816c2..9b79067 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c
@@ -192,10 +192,8 @@ static int alloc_4k(struct mlx5_core_dev *dev, u64 *addr)
 	struct fw_page *fp;
 	unsigned n;
 
-	if (list_empty(&dev->priv.free_list)) {
+	if (list_empty(&dev->priv.free_list))
 		return -ENOMEM;
-		mlx5_core_warn(dev, "\n");
-	}
 
 	fp = list_entry(dev->priv.free_list.next, struct fw_page, list);
 	n = find_first_bit(&fp->bitmask, 8 * sizeof(fp->bitmask));
--
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 related	[flat|nested] 5+ messages in thread

* Re: [patch v2] mlx5_core: delete some dead code
  2013-11-04 22:20     ` [patch v2] mlx5_core: delete some dead code Dan Carpenter
@ 2013-11-05 20:51       ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2013-11-05 20:51 UTC (permalink / raw)
  To: dan.carpenter; +Cc: eli, netdev, linux-rdma, kernel-janitors

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Tue, 5 Nov 2013 01:20:56 +0300

> The printk() looks like it is left over debug code.  I have removed it.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> v2:  Remove the printk instead of moving it infront of the return.

This doesn't apply to the current tree, I suspect some recent changes made
this fix no longer applicable.  Please take a look.

Thanks!

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

end of thread, other threads:[~2013-11-05 20:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-01 10:20 [patch -next] mlx5_core: warn if no space left in alloc_4k() Dan Carpenter
     [not found] ` <20131101102044.GB29795-dZEljifmRObu9KfB+GxooP8+0UxHXcjY@public.gmane.org>
2013-11-03  7:03   ` Eli Cohen
2013-11-03 23:16     ` Dan Carpenter
2013-11-04 22:20     ` [patch v2] mlx5_core: delete some dead code Dan Carpenter
2013-11-05 20:51       ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).