Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp803518rdb; Fri, 25 Aug 2023 01:14:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHe9SOw65ZcET0HqqkYkt5tiIoCWk6laQUy4YhRksQmfFC/FZHuwkSitmIXfq0CGXIVqk5g X-Received: by 2002:a05:6358:c1f:b0:139:d4f9:aef with SMTP id f31-20020a0563580c1f00b00139d4f90aefmr18044347rwj.3.1692951271019; Fri, 25 Aug 2023 01:14:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692951270; cv=none; d=google.com; s=arc-20160816; b=sbeLQlCEwXE45Ln9Zj63cBW455rK7ISgOA1ghLqhFJOeATCxu3VE7vhXho0tcex85Q MBRTM9vWymvosuc0eudYizcTSeEUiHM6fFyflyxjtHvOObb4F4S2gu+O7FjMfXrTEWRw mrBoPRQ5JDIsrzzoLoZ7/XAsMKvBfXt8vTWzd2qNyS5rJqmmhBMGhLZ+5jmwtalpLf5z az5P7b+0RJeT4jTlY0Qh2ba+4CbqF6ZIXcwXXw41F+hiqytZKnft/a9tRgOiWkuvY04K 8kt39UCZoX6N9GiO/SG3XJd4np0m5JFsLigQRDLIm/hDXH+heiRHilShsGv5pkBcWpQ+ 7PdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=+p7qgtJG6hjysfP/Q8t7GWEN+/rekBztiCyy3pfLpG0=; fh=TFUDKQlEmGeb0ncUclLRO0VC/XYHbMrSz2+fR2OZxDo=; b=UhGe63WdT6x9bChZoBZGLl+iRP9SrYAEwd8cO8uV9ArNlwhgA3CIWQPzQvBwwi3xfV KTz1BfxLC1iaH/QCDu9L4pNJpPsWe6ez/+VQgz6X0ngXSJmagSl7HVIovAsM4hUbc7cJ hsdBiPymsSUNZU+kzn6PJKb+daCj2A3zcpCJZTjwG/GaY5/To6U/+16ig1W7JYcgVcv9 I20jmXqapIa+bezt3K64qnh2iIgWBHFYsI3SbbR2//QWFh7xsdpRN7FIt6N+a9vhD4Mo 3mpSjQtHxRO5vUgJbhHPPm6zrUv95Bj/ujqY4VVZ24TBQTca9EefGui00Y64gKS3bR6T 0vwQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i71-20020a63874a000000b0056a77ae0b54si1105255pge.442.2023.08.25.01.14.16; Fri, 25 Aug 2023 01:14:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242359AbjHYGrn (ORCPT + 99 others); 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: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=6231 Signed-off-by: Jiapeng Chong --- 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 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(); -- 2.20.1.7.g153144c