linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/mlx5: Use PTR_ERR_OR_ZERO rather than its implementation
@ 2019-09-03  6:56 zhong jiang
  2019-09-03 20:08 ` Saeed Mahameed
  0 siblings, 1 reply; 3+ messages in thread
From: zhong jiang @ 2019-09-03  6:56 UTC (permalink / raw)
  To: davem; +Cc: saeedm, leon, netdev, linux-kernel, zhongjiang

PTR_ERR_OR_ZERO contains if(IS_ERR(...)) + PTR_ERR. It is better
to use it directly. hence just replace it.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 5581a80..2e0b467 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -989,10 +989,7 @@ static void mlx5e_hairpin_flow_del(struct mlx5e_priv *priv,
 					    &flow_act, dest, dest_ix);
 	mutex_unlock(&priv->fs.tc.t_lock);
 
-	if (IS_ERR(flow->rule[0]))
-		return PTR_ERR(flow->rule[0]);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(flow->rule[0]);
 }
 
 static void mlx5e_tc_del_nic_flow(struct mlx5e_priv *priv,
-- 
1.7.12.4


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

* Re: [PATCH] net/mlx5: Use PTR_ERR_OR_ZERO rather than its implementation
  2019-09-03  6:56 [PATCH] net/mlx5: Use PTR_ERR_OR_ZERO rather than its implementation zhong jiang
@ 2019-09-03 20:08 ` Saeed Mahameed
  2019-09-04 23:29   ` Saeed Mahameed
  0 siblings, 1 reply; 3+ messages in thread
From: Saeed Mahameed @ 2019-09-03 20:08 UTC (permalink / raw)
  To: zhongjiang, davem; +Cc: netdev, linux-kernel, leon

On Tue, 2019-09-03 at 14:56 +0800, zhong jiang wrote:
> PTR_ERR_OR_ZERO contains if(IS_ERR(...)) + PTR_ERR. It is better
> to use it directly. hence just replace it.
> 
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> index 5581a80..2e0b467 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> @@ -989,10 +989,7 @@ static void mlx5e_hairpin_flow_del(struct
> mlx5e_priv *priv,
>  					    &flow_act, dest, dest_ix);
>  	mutex_unlock(&priv->fs.tc.t_lock);
>  
> -	if (IS_ERR(flow->rule[0]))
> -		return PTR_ERR(flow->rule[0]);
> -
> -	return 0;
> +	return PTR_ERR_OR_ZERO(flow->rule[0]);
>  }
>  
>  static void mlx5e_tc_del_nic_flow(struct mlx5e_priv *priv,

Acked-by: Saeed Mahameed <saeedm@mellanox.com>

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

* Re: [PATCH] net/mlx5: Use PTR_ERR_OR_ZERO rather than its implementation
  2019-09-03 20:08 ` Saeed Mahameed
@ 2019-09-04 23:29   ` Saeed Mahameed
  0 siblings, 0 replies; 3+ messages in thread
From: Saeed Mahameed @ 2019-09-04 23:29 UTC (permalink / raw)
  To: zhongjiang, davem; +Cc: netdev, linux-kernel, leon

On Tue, 2019-09-03 at 20:08 +0000, Saeed Mahameed wrote:
> On Tue, 2019-09-03 at 14:56 +0800, zhong jiang wrote:
> > PTR_ERR_OR_ZERO contains if(IS_ERR(...)) + PTR_ERR. It is better
> > to use it directly. hence just replace it.
> > 
> > Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> > ---
> >  drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 5 +----
> >  1 file changed, 1 insertion(+), 4 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> > b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> > index 5581a80..2e0b467 100644
> > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> > @@ -989,10 +989,7 @@ static void mlx5e_hairpin_flow_del(struct
> > mlx5e_priv *priv,
> >  					    &flow_act, dest, dest_ix);
> >  	mutex_unlock(&priv->fs.tc.t_lock);
> >  
> > -	if (IS_ERR(flow->rule[0]))
> > -		return PTR_ERR(flow->rule[0]);
> > -
> > -	return 0;
> > +	return PTR_ERR_OR_ZERO(flow->rule[0]);
> >  }
> >  
> >  static void mlx5e_tc_del_nic_flow(struct mlx5e_priv *priv,
> 
> Acked-by: Saeed Mahameed <saeedm@mellanox.com>

Applied to net-next-mlx5 as i have a cleanup series coming up soon.

Thanks,
Saeed.

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

end of thread, other threads:[~2019-09-04 23:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-03  6:56 [PATCH] net/mlx5: Use PTR_ERR_OR_ZERO rather than its implementation zhong jiang
2019-09-03 20:08 ` Saeed Mahameed
2019-09-04 23:29   ` Saeed Mahameed

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).