* [PATCH can-next] can: raw: remove redundant NULL check before netdev_hold()
@ 2026-08-31 5:20 Sang-Heon Jeon
2026-08-31 6:52 ` Oliver Hartkopp
0 siblings, 1 reply; 2+ messages in thread
From: Sang-Heon Jeon @ 2026-08-31 5:20 UTC (permalink / raw)
To: Oliver Hartkopp, Marc Kleine-Budde; +Cc: linux-can, linux-kernel
netdev_hold() does nothing if dev is NULL, so the check before the call
is redundant.
So remove it. No functional change.
This is the result of running the Coccinelle script from
scripts/coccinelle/free/ifnulldev_put.cocci after commit f83b8a58695c
("coccinelle: ifnulldev_put: update outdated helper names").
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
net/can/raw.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/can/raw.c b/net/can/raw.c
index 82d9c0499c95..e1d05a0341eb 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -525,8 +525,7 @@ static int raw_bind(struct socket *sock, struct sockaddr_unsized *uaddr, int len
ro->bound = 1;
/* bind() ok -> hold a reference for new ro->dev */
ro->dev = dev;
- if (ro->dev)
- netdev_hold(ro->dev, &ro->dev_tracker, GFP_KERNEL);
+ netdev_hold(ro->dev, &ro->dev_tracker, GFP_KERNEL);
}
out_put_dev:
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH can-next] can: raw: remove redundant NULL check before netdev_hold()
2026-08-31 5:20 [PATCH can-next] can: raw: remove redundant NULL check before netdev_hold() Sang-Heon Jeon
@ 2026-08-31 6:52 ` Oliver Hartkopp
0 siblings, 0 replies; 2+ messages in thread
From: Oliver Hartkopp @ 2026-08-31 6:52 UTC (permalink / raw)
To: Sang-Heon Jeon, Marc Kleine-Budde; +Cc: linux-can, linux-kernel
On 31.08.26 07:20, Sang-Heon Jeon wrote:
> netdev_hold() does nothing if dev is NULL, so the check before the call
> is redundant.
>
> So remove it. No functional change.
>
> This is the result of running the Coccinelle script from
> scripts/coccinelle/free/ifnulldev_put.cocci after commit f83b8a58695c
> ("coccinelle: ifnulldev_put: update outdated helper names").
>
> Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Many thanks!
> ---
> net/can/raw.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/net/can/raw.c b/net/can/raw.c
> index 82d9c0499c95..e1d05a0341eb 100644
> --- a/net/can/raw.c
> +++ b/net/can/raw.c
> @@ -525,8 +525,7 @@ static int raw_bind(struct socket *sock, struct sockaddr_unsized *uaddr, int len
> ro->bound = 1;
> /* bind() ok -> hold a reference for new ro->dev */
> ro->dev = dev;
> - if (ro->dev)
> - netdev_hold(ro->dev, &ro->dev_tracker, GFP_KERNEL);
> + netdev_hold(ro->dev, &ro->dev_tracker, GFP_KERNEL);
> }
>
> out_put_dev:
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-31 6:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-31 5:20 [PATCH can-next] can: raw: remove redundant NULL check before netdev_hold() Sang-Heon Jeon
2026-08-31 6:52 ` Oliver Hartkopp
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®