netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] net/mlx5: Use PTR_ERR_OR_ZERO() to simplify the code
@ 2016-07-19 11:35 Wei Yongjun
       [not found] ` <1468928146-4841-1-git-send-email-weiyj_lk-9Onoh4P/yGk@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Yongjun @ 2016-07-19 11:35 UTC (permalink / raw)
  To: Matan Barak, Leon Romanovsky
  Cc: Wei Yongjun, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA

From: Wei Yongjun <yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org>

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-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org>
---
 drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

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)




--
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] 3+ messages in thread

* Re: [PATCH -next] net/mlx5: Use PTR_ERR_OR_ZERO() to simplify the code
       [not found] ` <1468928146-4841-1-git-send-email-weiyj_lk-9Onoh4P/yGk@public.gmane.org>
@ 2016-07-19 13:05   ` Leon Romanovsky
  2016-07-20 21:48   ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2016-07-19 13:05 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: Matan Barak, Wei Yongjun, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 456 bytes --]

On Tue, Jul 19, 2016 at 11:35:46AM +0000, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org>
> 
> 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-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org>

Thanks,
Acked-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH -next] net/mlx5: Use PTR_ERR_OR_ZERO() to simplify the code
       [not found] ` <1468928146-4841-1-git-send-email-weiyj_lk-9Onoh4P/yGk@public.gmane.org>
  2016-07-19 13:05   ` Leon Romanovsky
@ 2016-07-20 21:48   ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-07-20 21:48 UTC (permalink / raw)
  To: weiyj_lk-9Onoh4P/yGk
  Cc: matanb-VPRAkNaXOzVWk0Htik3J/w, leonro-VPRAkNaXOzVWk0Htik3J/w,
	yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY,
	netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA

From: Wei Yongjun <weiyj_lk-9Onoh4P/yGk@public.gmane.org>
Date: Tue, 19 Jul 2016 11:35:46 +0000

> From: Wei Yongjun <yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org>
> 
> 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-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org>

Applied.
--
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] 3+ messages in thread

end of thread, other threads:[~2016-07-20 21:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-19 11:35 [PATCH -next] net/mlx5: Use PTR_ERR_OR_ZERO() to simplify the code Wei Yongjun
     [not found] ` <1468928146-4841-1-git-send-email-weiyj_lk-9Onoh4P/yGk@public.gmane.org>
2016-07-19 13:05   ` Leon Romanovsky
2016-07-20 21:48   ` 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).