diff options
author | Jiapeng Chong <jiapeng.chong@linux.alibaba.com> | 2023-08-25 14:46:56 +0800 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2023-10-04 12:25:12 +0200 |
commit | dd8bb80308c474ea0e7ddb244962cb2d7001bae2 (patch) | |
tree | 74fee354bdad464bafa2cbecb7629e51b2f29aa7 /net | |
parent | 2806d74deb42f7a253a40d032153c628f37c19ce (diff) |
can: raw: Remove NULL check before dev_{put, hold}
The call netdev_{put, hold} of dev_{put, hold} will check NULL, so there
is no need to check before using dev_{put, hold}, remove it to silence
the warning:
./net/can/raw.c:497:2-9: WARNING: NULL check before dev_{put, hold} functions is not needed.
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=6231
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Reported-by: Simon Horman <horms@kernel.org>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Link: https://lore.kernel.org/all/20230825064656.87751-1-jiapeng.chong@linux.alibaba.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'net')
-rw-r--r-- | net/can/raw.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/net/can/raw.c b/net/can/raw.c index 73468d2ebd51..e6b822624ba2 100644 --- a/net/can/raw.c +++ b/net/can/raw.c @@ -493,8 +493,7 @@ static int raw_bind(struct socket *sock, struct sockaddr *uaddr, int len) out_put_dev: /* remove potential reference from dev_get_by_index() */ - if (dev) - dev_put(dev); + dev_put(dev); out: release_sock(sk); rtnl_unlock(); |