[PATCH net-next 0/2] net: Use helper function IS_ERR_OR_NULL()
Leon Romanovsky
leon at kernel.org
Thu Aug 17 01:02:57 PDT 2023
On Thu, Aug 17, 2023 at 03:19:39PM +0800, Ruan Jinjie wrote:
> Use IS_ERR_OR_NULL() instead of open-coding it
> to simplify the code.
>
> Ruan Jinjie (2):
> net: microchip: sparx5: Use helper function IS_ERR_OR_NULL()
> net: stmmac: Use helper function IS_ERR_OR_NULL()
>
> drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c | 2 +-
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
Thanks,
Reviewed-by: Leon Romanovsky <leonro at nvidia.com>
As a side note, grep of vcap_get_rule() shows that many callers don't
properly check return value and expect it to be or valid or NULL.
For example this code is not correct:
drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c
61 vrule = vcap_get_rule(lan966x->vcap_ctrl, rule_id);
62 if (vrule) {
63 u32 value, mask;
64
65 /* Just modify the ingress port mask and exit */
66 vcap_rule_get_key_u32(vrule, VCAP_KF_IF_IGR_PORT_MASK,
67 &value, &mask);
68 mask &= ~BIT(port->chip_port);
69 vcap_rule_mod_key_u32(vrule, VCAP_KF_IF_IGR_PORT_MASK,
70 value, mask);
71
72 err = vcap_mod_rule(vrule);
73 goto free_rule;
74 }
More information about the linux-arm-kernel
mailing list