[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230817080257.GD22185@unreal>
Date: Thu, 17 Aug 2023 11:02:57 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Ruan Jinjie <ruanjinjie@...wei.com>
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, lars.povlsen@...rochip.com,
Steen.Hegelund@...rochip.com, daniel.machon@...rochip.com,
alexandre.torgue@...s.st.com, joabreu@...opsys.com,
mcoquelin.stm32@...il.com, horatiu.vultur@...rochip.com,
simon.horman@...igine.com, netdev@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-stm32@...md-mailman.stormreply.com
Subject: Re: [PATCH net-next 0/2] net: Use helper function IS_ERR_OR_NULL()
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@...dia.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 }
Powered by blists - more mailing lists