From nobody Sat Feb 7 22:21:13 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18918EE49A5 for ; Fri, 25 Aug 2023 06:48:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242360AbjHYGrn (ORCPT ); Fri, 25 Aug 2023 02:47:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236416AbjHYGrL (ORCPT ); Fri, 25 Aug 2023 02:47:11 -0400 Received: from out30-101.freemail.mail.aliyun.com (out30-101.freemail.mail.aliyun.com [115.124.30.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CF68CE; Thu, 24 Aug 2023 23:47:07 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R571e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0VqW2QpI_1692946019; Received: from localhost(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0VqW2QpI_1692946019) by smtp.aliyun-inc.com; Fri, 25 Aug 2023 14:47:05 +0800 From: Jiapeng Chong To: socketcan@hartkopp.net Cc: mkl@pengutronix.de, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jiapeng Chong , Abaci Robot Subject: [PATCH] can: raw: Remove NULL check before dev_{put, hold} Date: Fri, 25 Aug 2023 14:46:56 +0800 Message-Id: <20230825064656.87751-1-jiapeng.chong@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.7.g153144c MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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} functio= ns is not needed. Reported-by: Abaci Robot Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=3D6231 Signed-off-by: Jiapeng Chong Acked-by: Oliver Hartkopp Reported-by: Simon Horman --- 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 d50c3f3d892f..ff7797c37018 100644 --- a/net/can/raw.c +++ b/net/can/raw.c @@ -493,8 +493,7 @@ static int raw_bind(struct socket *sock, struct sockadd= r *uaddr, int len) =20 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(); --=20 2.20.1.7.g153144c