diff mbox

[-next] mlx5_core: warn if no space left in alloc_4k()

Message ID 20131101102044.GB29795@longonot.mountain
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Dan Carpenter Nov. 1, 2013, 10:20 a.m. UTC
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.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Eli Cohen Nov. 3, 2013, 7:03 a.m. UTC | #1
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.

>  
>  	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@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dan Carpenter Nov. 3, 2013, 11:16 p.m. UTC | #2
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

--
To unsubscribe from this list: send the line "unsubscribe netdev" 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/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);