net/ipv6/mcast.c | 2 -- 1 file changed, 2 deletions(-)
These is no need to check null for pmc twice.
Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
---
net/ipv6/mcast.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 6c875721d423..f3dae72aa9d3 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -794,9 +794,7 @@ static void mld_del_delrec(struct inet6_dev *idev, struct ifmcaddr6 *im)
rcu_assign_pointer(pmc_prev->next, pmc->next);
else
rcu_assign_pointer(idev->mc_tomb, pmc->next);
- }
- if (pmc) {
im->idev = pmc->idev;
if (im->mca_sfmode == MCAST_INCLUDE) {
tomb = rcu_replace_pointer(im->mca_tomb,
--
2.34.1
On Sat, Jul 12, 2025 at 2:06 AM Yue Haibing <yuehaibing@huawei.com> wrote:
>
> These is no need to check null for pmc twice.
>
> Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
> ---
> net/ipv6/mcast.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
> index 6c875721d423..f3dae72aa9d3 100644
> --- a/net/ipv6/mcast.c
> +++ b/net/ipv6/mcast.c
> @@ -794,9 +794,7 @@ static void mld_del_delrec(struct inet6_dev *idev, struct ifmcaddr6 *im)
Rather early return after the first loop if (!pmc) and
remove 1 nest level below.
> rcu_assign_pointer(pmc_prev->next, pmc->next);
> else
> rcu_assign_pointer(idev->mc_tomb, pmc->next);
> - }
>
> - if (pmc) {
> im->idev = pmc->idev;
> if (im->mca_sfmode == MCAST_INCLUDE) {
> tomb = rcu_replace_pointer(im->mca_tomb,
> --
> 2.34.1
>
On 2025/7/13 6:12, Kuniyuki Iwashima wrote:
> On Sat, Jul 12, 2025 at 2:06 AM Yue Haibing <yuehaibing@huawei.com> wrote:
>>
>> These is no need to check null for pmc twice.
>>
>> Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
>> ---
>> net/ipv6/mcast.c | 2 --
>> 1 file changed, 2 deletions(-)
>>
>> diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
>> index 6c875721d423..f3dae72aa9d3 100644
>> --- a/net/ipv6/mcast.c
>> +++ b/net/ipv6/mcast.c
>> @@ -794,9 +794,7 @@ static void mld_del_delrec(struct inet6_dev *idev, struct ifmcaddr6 *im)
>
> Rather early return after the first loop if (!pmc) and
> remove 1 nest level below.
Thanks, will do in v2.
>
>
>> rcu_assign_pointer(pmc_prev->next, pmc->next);
>> else
>> rcu_assign_pointer(idev->mc_tomb, pmc->next);
>> - }
>>
>> - if (pmc) {
>> im->idev = pmc->idev;
>> if (im->mca_sfmode == MCAST_INCLUDE) {
>> tomb = rcu_replace_pointer(im->mca_tomb,
>> --
>> 2.34.1
>>
>
> These is no need to check null for pmc twice. Can another wording approach be more appropriate? Avoid a duplicate pointer check in this function implementation. Regards, Markus
On 2025/7/13 3:32, Markus Elfring wrote: >> These is no need to check null for pmc twice. > > Can another wording approach be more appropriate? > > Avoid a duplicate pointer check in this function implementation. Ok, thanks. > > > Regards, > Markus
© 2016 - 2026 Red Hat, Inc.