netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] ipv6: mcast: Remove unnecessary null check in mld_del_delrec()
@ 2025-07-12  9:28 Yue Haibing
  2025-07-12 19:32 ` Markus Elfring
  2025-07-12 22:12 ` Kuniyuki Iwashima
  0 siblings, 2 replies; 5+ messages in thread
From: Yue Haibing @ 2025-07-12  9:28 UTC (permalink / raw)
  To: davem, dsahern, edumazet, kuba, pabeni, horms, kuniyu
  Cc: netdev, linux-kernel, yuehaibing

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] ipv6: mcast: Remove unnecessary null check in mld_del_delrec()
  2025-07-12  9:28 [PATCH net-next] ipv6: mcast: Remove unnecessary null check in mld_del_delrec() Yue Haibing
@ 2025-07-12 19:32 ` Markus Elfring
  2025-07-14  1:33   ` Yue Haibing
  2025-07-12 22:12 ` Kuniyuki Iwashima
  1 sibling, 1 reply; 5+ messages in thread
From: Markus Elfring @ 2025-07-12 19:32 UTC (permalink / raw)
  To: Yue Haibing, netdev, David Ahern, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Kuniyuki Iwashima, Paolo Abeni, Simon Horman
  Cc: LKML

> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] ipv6: mcast: Remove unnecessary null check in mld_del_delrec()
  2025-07-12  9:28 [PATCH net-next] ipv6: mcast: Remove unnecessary null check in mld_del_delrec() Yue Haibing
  2025-07-12 19:32 ` Markus Elfring
@ 2025-07-12 22:12 ` Kuniyuki Iwashima
  2025-07-14  1:32   ` Yue Haibing
  1 sibling, 1 reply; 5+ messages in thread
From: Kuniyuki Iwashima @ 2025-07-12 22:12 UTC (permalink / raw)
  To: Yue Haibing
  Cc: davem, dsahern, edumazet, kuba, pabeni, horms, netdev,
	linux-kernel

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
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] ipv6: mcast: Remove unnecessary null check in mld_del_delrec()
  2025-07-12 22:12 ` Kuniyuki Iwashima
@ 2025-07-14  1:32   ` Yue Haibing
  0 siblings, 0 replies; 5+ messages in thread
From: Yue Haibing @ 2025-07-14  1:32 UTC (permalink / raw)
  To: Kuniyuki Iwashima
  Cc: davem, dsahern, edumazet, kuba, pabeni, horms, netdev,
	linux-kernel

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] ipv6: mcast: Remove unnecessary null check in mld_del_delrec()
  2025-07-12 19:32 ` Markus Elfring
@ 2025-07-14  1:33   ` Yue Haibing
  0 siblings, 0 replies; 5+ messages in thread
From: Yue Haibing @ 2025-07-14  1:33 UTC (permalink / raw)
  To: Markus Elfring, netdev, David Ahern, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Kuniyuki Iwashima, Paolo Abeni,
	Simon Horman
  Cc: LKML

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-07-14  1:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-12  9:28 [PATCH net-next] ipv6: mcast: Remove unnecessary null check in mld_del_delrec() Yue Haibing
2025-07-12 19:32 ` Markus Elfring
2025-07-14  1:33   ` Yue Haibing
2025-07-12 22:12 ` Kuniyuki Iwashima
2025-07-14  1:32   ` Yue Haibing

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).