diff mbox

[-next] net/mlx5: Use PTR_ERR_OR_ZERO() to simplify the code

Message ID 1468928146-4841-1-git-send-email-weiyj_lk@163.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

weiyj_lk@163.com July 19, 2016, 11:35 a.m. UTC
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR.

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)





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

Comments

Leon Romanovsky July 19, 2016, 1:05 p.m. UTC | #1
On Tue, Jul 19, 2016 at 11:35:46AM +0000, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR.
> 
> Generated by: scripts/coccinelle/api/ptr_ret.cocci
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Thanks,
Acked-by: Leon Romanovsky <leonro@mellanox.com>
David Miller July 20, 2016, 9:48 p.m. UTC | #2
From: Wei Yongjun <weiyj_lk@163.com>
Date: Tue, 19 Jul 2016 11:35:46 +0000

> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR.
> 
> Generated by: scripts/coccinelle/api/ptr_ret.cocci
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Applied.
--
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/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
index 1a377b4..75bb8c8 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
@@ -1740,10 +1740,7 @@  static int init_ingress_acl_root_ns(struct mlx5_flow_steering *steering)
 	/* create 1 prio*/
 	prio = fs_create_prio(&steering->esw_egress_root_ns->ns, 0,
 			      MLX5_TOTAL_VPORTS(steering->dev));
-	if (IS_ERR(prio))
-		return PTR_ERR(prio);
-	else
-		return 0;
+	return PTR_ERR_OR_ZERO(prio);
 }
 
 static int init_egress_acl_root_ns(struct mlx5_flow_steering *steering)
@@ -1757,10 +1754,7 @@  static int init_egress_acl_root_ns(struct mlx5_flow_steering *steering)
 	/* create 1 prio*/
 	prio = fs_create_prio(&steering->esw_ingress_root_ns->ns, 0,
 			      MLX5_TOTAL_VPORTS(steering->dev));
-	if (IS_ERR(prio))
-		return PTR_ERR(prio);
-	else
-		return 0;
+	return PTR_ERR_OR_ZERO(prio);
 }
 
 int mlx5_init_fs(struct mlx5_core_dev *dev)