can: raw: remove redundant NULL check before netdev_hold()
Subsystems (2)
PATCH 1/1 can: raw: remove redundant NULL check before netdev_hold()
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 <[email protected]>
--- net/can/raw.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/can/raw.c +1 -2
@@ -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:
Signature · 1 line
2.43.0
Quoted 10 lines · Sang-Heon Jeon
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.cocciafter commitf83b8a58695c("coccinelle:ifnulldev_put: update outdated helper names").Signed-off-by Sang-Heon Jeon <[email protected]>
Acked-by Oliver Hartkopp <[email protected]>
Many thanks!
Quoted 18 lines
--- net/can/raw.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)net/can/raw.c +1
-2@@ -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: