diff mbox series

[net-next,v2,3/3] net: microchip: sparx5: Update return value check for vcap_get_rule()

Message ID 20230818050505.3634668-4-ruanjinjie@huawei.com (mailing list archive)
State New, archived
Headers show
Series net: Update and fix return value check for vcap_get_rule() | expand

Commit Message

Jinjie Ruan Aug. 18, 2023, 5:05 a.m. UTC
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(-)

Comments

Leon Romanovsky Aug. 18, 2023, 6:56 p.m. UTC | #1
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>
diff mbox series

Patch

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