netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/3] net: Update and fix return value check for vcap_get_rule()
@ 2023-08-18  5:05 Ruan Jinjie
  2023-08-18  5:05 ` [PATCH net-next v2 1/3] net: microchip: vcap api: Always return ERR_PTR " Ruan Jinjie
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Ruan Jinjie @ 2023-08-18  5:05 UTC (permalink / raw)
  To: horatiu.vultur, davem, edumazet, kuba, pabeni, lars.povlsen,
	Steen.Hegelund, daniel.machon, richardcochran, horms, netdev,
	linux-arm-kernel
  Cc: ruanjinjie

As Simon Horman suggests, update vcap_get_rule() to always
return an ERR_PTR() and update the error detection conditions to
use IS_ERR(), which would be more cleaner.

So se IS_ERR() to update the return value and fix the issue
in lan966x_ptp_add_trap().

Changes in v2:
- Update vcap_get_rule() to always return an ERR_PTR().
- Update the return value fix in lan966x_ptp_add_trap().
- Update the return value check in sparx5_tc_free_rule_resources().

Ruan Jinjie (3):
  net: microchip: vcap api: Always return ERR_PTR for vcap_get_rule()
  net: lan966x: Fix return value check for vcap_get_rule()
  net: microchip: sparx5: Update return value check for vcap_get_rule()

 drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c     | 4 ++--
 drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c | 2 +-
 drivers/net/ethernet/microchip/vcap/vcap_api.c           | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

-- 
2.34.1


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

* [PATCH net-next v2 1/3] net: microchip: vcap api: Always return ERR_PTR for vcap_get_rule()
  2023-08-18  5:05 [PATCH net-next v2 0/3] net: Update and fix return value check for vcap_get_rule() Ruan Jinjie
@ 2023-08-18  5:05 ` Ruan Jinjie
  2023-08-18 18:56   ` Leon Romanovsky
  2023-08-18  5:05 ` [PATCH net-next v2 2/3] net: lan966x: Fix return value check " Ruan Jinjie
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Ruan Jinjie @ 2023-08-18  5:05 UTC (permalink / raw)
  To: horatiu.vultur, davem, edumazet, kuba, pabeni, lars.povlsen,
	Steen.Hegelund, daniel.machon, richardcochran, horms, netdev,
	linux-arm-kernel
  Cc: ruanjinjie

As Simon Horman suggests, update vcap_get_rule() to always
return an ERR_PTR() and update the error detection conditions to
use IS_ERR(), which would be more cleaner in this case.

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Suggested-by: Simon Horman <horms@kernel.org>
---
 drivers/net/ethernet/microchip/vcap/vcap_api.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/microchip/vcap/vcap_api.c b/drivers/net/ethernet/microchip/vcap/vcap_api.c
index a7b43f99bc80..300fe1a93dce 100644
--- a/drivers/net/ethernet/microchip/vcap/vcap_api.c
+++ b/drivers/net/ethernet/microchip/vcap/vcap_api.c
@@ -2429,7 +2429,7 @@ struct vcap_rule *vcap_get_rule(struct vcap_control *vctrl, u32 id)
 
 	elem = vcap_get_locked_rule(vctrl, id);
 	if (!elem)
-		return NULL;
+		return ERR_PTR(-ENOENT);
 
 	rule = vcap_decode_rule(elem);
 	mutex_unlock(&elem->admin->lock);
-- 
2.34.1


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

* [PATCH net-next v2 2/3] net: lan966x: Fix return value check for vcap_get_rule()
  2023-08-18  5:05 [PATCH net-next v2 0/3] net: Update and fix return value check for vcap_get_rule() Ruan Jinjie
  2023-08-18  5:05 ` [PATCH net-next v2 1/3] net: microchip: vcap api: Always return ERR_PTR " Ruan Jinjie
@ 2023-08-18  5:05 ` Ruan Jinjie
  2023-08-18 18:56   ` Leon Romanovsky
  2023-08-18  5:05 ` [PATCH net-next v2 3/3] net: microchip: sparx5: Update " Ruan Jinjie
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Ruan Jinjie @ 2023-08-18  5:05 UTC (permalink / raw)
  To: horatiu.vultur, davem, edumazet, kuba, pabeni, lars.povlsen,
	Steen.Hegelund, daniel.machon, richardcochran, horms, netdev,
	linux-arm-kernel
  Cc: ruanjinjie

As Simon Horman suggests, update vcap_get_rule() to always
return an ERR_PTR() and update the error detection conditions to
use IS_ERR(), so use IS_ERR() to fix the return value issue.

Fixes: 72df3489fb10 ("net: lan966x: Add ptp trap rules")
Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Suggested-by: Simon Horman <horms@kernel.org>
---
v2:
- Update vcap_get_rule() to always return ERR_PTR instead of checking IS_ERR_OR_NULL()
- Update the commit message.
- Check IS_ERR() instead of NULL.
---
 drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c b/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c
index 60bd0cff6677..63905bb5a63a 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c
@@ -59,7 +59,7 @@ static int lan966x_ptp_add_trap(struct lan966x_port *port,
 	int err;
 
 	vrule = vcap_get_rule(lan966x->vcap_ctrl, rule_id);
-	if (vrule) {
+	if (!IS_ERR(vrule)) {
 		u32 value, mask;
 
 		/* Just modify the ingress port mask and exit */
@@ -106,7 +106,7 @@ static int lan966x_ptp_del_trap(struct lan966x_port *port,
 	int err;
 
 	vrule = vcap_get_rule(lan966x->vcap_ctrl, rule_id);
-	if (!vrule)
+	if (IS_ERR(vrule))
 		return -EEXIST;
 
 	vcap_rule_get_key_u32(vrule, VCAP_KF_IF_IGR_PORT_MASK, &value, &mask);
-- 
2.34.1


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

* [PATCH net-next v2 3/3] net: microchip: sparx5: Update return value check for vcap_get_rule()
  2023-08-18  5:05 [PATCH net-next v2 0/3] net: Update and fix return value check for vcap_get_rule() Ruan Jinjie
  2023-08-18  5:05 ` [PATCH net-next v2 1/3] net: microchip: vcap api: Always return ERR_PTR " Ruan Jinjie
  2023-08-18  5:05 ` [PATCH net-next v2 2/3] net: lan966x: Fix return value check " Ruan Jinjie
@ 2023-08-18  5:05 ` Ruan Jinjie
  2023-08-18 18:56   ` Leon Romanovsky
  2023-08-19  7:03 ` [PATCH net-next v2 0/3] net: Update and fix " Simon Horman
  2023-08-19 18:43 ` patchwork-bot+netdevbpf
  4 siblings, 1 reply; 9+ messages in thread
From: Ruan Jinjie @ 2023-08-18  5:05 UTC (permalink / raw)
  To: horatiu.vultur, davem, edumazet, kuba, pabeni, lars.povlsen,
	Steen.Hegelund, daniel.machon, richardcochran, horms, netdev,
	linux-arm-kernel
  Cc: ruanjinjie

As Simon Horman suggests, update vcap_get_rule() to always
return an ERR_PTR() and update the error detection conditions to
use IS_ERR(), so use IS_ERR() to check the return value.

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Suggested-by: Simon Horman <horms@kernel.org>
---
 drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c b/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c
index 906299ad8425..523e0c470894 100644
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c
@@ -1274,7 +1274,7 @@ static int sparx5_tc_free_rule_resources(struct net_device *ndev,
 	int ret = 0;
 
 	vrule = vcap_get_rule(vctrl, rule_id);
-	if (!vrule || IS_ERR(vrule))
+	if (IS_ERR(vrule))
 		return -EINVAL;
 
 	sparx5_tc_free_psfp_resources(sparx5, vrule);
-- 
2.34.1


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

* Re: [PATCH net-next v2 1/3] net: microchip: vcap api: Always return ERR_PTR for vcap_get_rule()
  2023-08-18  5:05 ` [PATCH net-next v2 1/3] net: microchip: vcap api: Always return ERR_PTR " Ruan Jinjie
@ 2023-08-18 18:56   ` Leon Romanovsky
  0 siblings, 0 replies; 9+ messages in thread
From: Leon Romanovsky @ 2023-08-18 18:56 UTC (permalink / raw)
  To: Ruan Jinjie
  Cc: horatiu.vultur, davem, edumazet, kuba, pabeni, lars.povlsen,
	Steen.Hegelund, daniel.machon, richardcochran, horms, netdev,
	linux-arm-kernel

On Fri, Aug 18, 2023 at 01:05:03PM +0800, Ruan Jinjie wrote:
> As Simon Horman suggests, update vcap_get_rule() to always
> return an ERR_PTR() and update the error detection conditions to
> use IS_ERR(), which would be more cleaner in this case.
> 
> Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
> Suggested-by: Simon Horman <horms@kernel.org>
> ---
>  drivers/net/ethernet/microchip/vcap/vcap_api.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

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

* Re: [PATCH net-next v2 2/3] net: lan966x: Fix return value check for vcap_get_rule()
  2023-08-18  5:05 ` [PATCH net-next v2 2/3] net: lan966x: Fix return value check " Ruan Jinjie
@ 2023-08-18 18:56   ` Leon Romanovsky
  0 siblings, 0 replies; 9+ messages in thread
From: Leon Romanovsky @ 2023-08-18 18:56 UTC (permalink / raw)
  To: Ruan Jinjie
  Cc: horatiu.vultur, davem, edumazet, kuba, pabeni, lars.povlsen,
	Steen.Hegelund, daniel.machon, richardcochran, horms, netdev,
	linux-arm-kernel

On Fri, Aug 18, 2023 at 01:05:04PM +0800, Ruan Jinjie wrote:
> As Simon Horman suggests, update vcap_get_rule() to always
> return an ERR_PTR() and update the error detection conditions to
> use IS_ERR(), so use IS_ERR() to fix the return value issue.
> 
> Fixes: 72df3489fb10 ("net: lan966x: Add ptp trap rules")
> Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
> Suggested-by: Simon Horman <horms@kernel.org>
> ---
> v2:
> - Update vcap_get_rule() to always return ERR_PTR instead of checking IS_ERR_OR_NULL()
> - Update the commit message.
> - Check IS_ERR() instead of NULL.
> ---
>  drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

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

* Re: [PATCH net-next v2 3/3] net: microchip: sparx5: Update return value check for vcap_get_rule()
  2023-08-18  5:05 ` [PATCH net-next v2 3/3] net: microchip: sparx5: Update " Ruan Jinjie
@ 2023-08-18 18:56   ` Leon Romanovsky
  0 siblings, 0 replies; 9+ messages in thread
From: Leon Romanovsky @ 2023-08-18 18:56 UTC (permalink / raw)
  To: Ruan Jinjie
  Cc: horatiu.vultur, davem, edumazet, kuba, pabeni, lars.povlsen,
	Steen.Hegelund, daniel.machon, richardcochran, horms, netdev,
	linux-arm-kernel

On Fri, Aug 18, 2023 at 01:05:05PM +0800, Ruan Jinjie wrote:
> As Simon Horman suggests, update vcap_get_rule() to always
> return an ERR_PTR() and update the error detection conditions to
> use IS_ERR(), so use IS_ERR() to check the return value.
> 
> Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
> Suggested-by: Simon Horman <horms@kernel.org>
> ---
>  drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

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

* Re: [PATCH net-next v2 0/3] net: Update and fix return value check for vcap_get_rule()
  2023-08-18  5:05 [PATCH net-next v2 0/3] net: Update and fix return value check for vcap_get_rule() Ruan Jinjie
                   ` (2 preceding siblings ...)
  2023-08-18  5:05 ` [PATCH net-next v2 3/3] net: microchip: sparx5: Update " Ruan Jinjie
@ 2023-08-19  7:03 ` Simon Horman
  2023-08-19 18:43 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 9+ messages in thread
From: Simon Horman @ 2023-08-19  7:03 UTC (permalink / raw)
  To: Ruan Jinjie
  Cc: horatiu.vultur, davem, edumazet, kuba, pabeni, lars.povlsen,
	Steen.Hegelund, daniel.machon, richardcochran, netdev,
	linux-arm-kernel

On Fri, Aug 18, 2023 at 01:05:02PM +0800, Ruan Jinjie wrote:
> As Simon Horman suggests, update vcap_get_rule() to always
> return an ERR_PTR() and update the error detection conditions to
> use IS_ERR(), which would be more cleaner.
> 
> So se IS_ERR() to update the return value and fix the issue
> in lan966x_ptp_add_trap().
> 
> Changes in v2:
> - Update vcap_get_rule() to always return an ERR_PTR().
> - Update the return value fix in lan966x_ptp_add_trap().
> - Update the return value check in sparx5_tc_free_rule_resources().
> 
> Ruan Jinjie (3):
>   net: microchip: vcap api: Always return ERR_PTR for vcap_get_rule()
>   net: lan966x: Fix return value check for vcap_get_rule()
>   net: microchip: sparx5: Update return value check for vcap_get_rule()

Thanks.

For the series,

Reviewed-by: Simon Horman <horms@kernel.org>


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

* Re: [PATCH net-next v2 0/3] net: Update and fix return value check for vcap_get_rule()
  2023-08-18  5:05 [PATCH net-next v2 0/3] net: Update and fix return value check for vcap_get_rule() Ruan Jinjie
                   ` (3 preceding siblings ...)
  2023-08-19  7:03 ` [PATCH net-next v2 0/3] net: Update and fix " Simon Horman
@ 2023-08-19 18:43 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 9+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-08-19 18:43 UTC (permalink / raw)
  To: Ruan Jinjie
  Cc: horatiu.vultur, davem, edumazet, kuba, pabeni, lars.povlsen,
	Steen.Hegelund, daniel.machon, richardcochran, horms, netdev,
	linux-arm-kernel

Hello:

This series was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

On Fri, 18 Aug 2023 13:05:02 +0800 you wrote:
> As Simon Horman suggests, update vcap_get_rule() to always
> return an ERR_PTR() and update the error detection conditions to
> use IS_ERR(), which would be more cleaner.
> 
> So se IS_ERR() to update the return value and fix the issue
> in lan966x_ptp_add_trap().
> 
> [...]

Here is the summary with links:
  - [net-next,v2,1/3] net: microchip: vcap api: Always return ERR_PTR for vcap_get_rule()
    https://git.kernel.org/netdev/net-next/c/093db9cda7b6
  - [net-next,v2,2/3] net: lan966x: Fix return value check for vcap_get_rule()
    https://git.kernel.org/netdev/net-next/c/ab104318f639
  - [net-next,v2,3/3] net: microchip: sparx5: Update return value check for vcap_get_rule()
    https://git.kernel.org/netdev/net-next/c/95b358e4d9c7

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2023-08-19 18:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-18  5:05 [PATCH net-next v2 0/3] net: Update and fix return value check for vcap_get_rule() Ruan Jinjie
2023-08-18  5:05 ` [PATCH net-next v2 1/3] net: microchip: vcap api: Always return ERR_PTR " Ruan Jinjie
2023-08-18 18:56   ` Leon Romanovsky
2023-08-18  5:05 ` [PATCH net-next v2 2/3] net: lan966x: Fix return value check " Ruan Jinjie
2023-08-18 18:56   ` Leon Romanovsky
2023-08-18  5:05 ` [PATCH net-next v2 3/3] net: microchip: sparx5: Update " Ruan Jinjie
2023-08-18 18:56   ` Leon Romanovsky
2023-08-19  7:03 ` [PATCH net-next v2 0/3] net: Update and fix " Simon Horman
2023-08-19 18:43 ` patchwork-bot+netdevbpf

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