[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5a885cda-4ee3-6c26-e6ea-5074427e974b@huawei.com>
Date: Thu, 17 Aug 2023 17:50:13 +0800
From: Ruan Jinjie <ruanjinjie@...wei.com>
To: Leon Romanovsky <leon@...nel.org>
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 2023/8/17 16:02, Leon Romanovsky wrote:
> 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.
Right! I will try to fix these problems together by the way. Thank you!
>
> 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