From patchwork Fri Mar 31 01:06:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Li X-Patchwork-Id: 77496 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp245913vqo; Thu, 30 Mar 2023 18:15:22 -0700 (PDT) X-Google-Smtp-Source: AKy350a/K98NpE8mkuXVxSkEB072XrDjLZ0wzjwE12Kk2dx0Y8TDIv+v+OJKi0TMcsXBhonjeuGf X-Received: by 2002:a17:902:c951:b0:1a2:3108:5cc9 with SMTP id i17-20020a170902c95100b001a231085cc9mr24574027pla.40.1680225321789; Thu, 30 Mar 2023 18:15:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680225321; cv=none; d=google.com; s=arc-20160816; b=wifU1xKtXiFxNNn3jCoIK7r2pcyqDcQhs/bXqC2H+dt2xV8YcC9ky7mUWG0XBaOEp5 4eQUvqRm9ZXkrXnnEIWhJDe1O9up5doWtcXJviDHJR5mCBfSmS3GhFidEHiZCZdX4Ryz O/aqqciN6mpzY7IdnA4iWw4Q4qjSWOMSSfrraEnXgNjqokNV0ym2XW47Ev2ojLiAz8q7 xdVd+e4xMBeE1X7fEP3fkRrv9NdlxRHlVJJXCmcFm6iUwJFlkO+scu3lV2gLxuXkitgt TWgvDYBCftgJH7drKqgp+C2How5SwVR6w+95wwRoXnIWrZnsYjrZJzLDdzO8twt9RxW0 zSeQ== 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=x4A9O/V0rstSIdJchK8zkM3uukjkriOK00F31jfqaCY=; b=h7UeA2kyxkvMDoT2ulTsFKr3lRXIhHURVMeexflZiANBIuaGmTEzctCKNjER9q+IhB 4VEsoYsRtcsQeHj5WpJu5NQegRkpqd78UxmkLCHZwmzmpQ0mM71rlbw6FHnsr4R0zKie RI4x+NCc3OtZyQrRIuisJNA2dQnt0a0JL2Xb3WluWvc4uQ7JiiNmDi+BOdM6xMUg+2rr RC1RwAhcfN6otCgmqUXL8Am5HnSUu2kz/miHydKYRGSqb5Hr33GNseVpbsPoIAVHcN4Z M+cW6z1Y2oKwfTLIxG8YvBZ2TN7+hZ15xARoCVIJ7ctWkkm2Lp3BWpiyxYFPbmJN4WZi g7jQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a22-20020a1709027d9600b001a1a737bc91si953028plm.45.2023.03.30.18.15.09; Thu, 30 Mar 2023 18:15:21 -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 S229600AbjCaBGk (ORCPT + 99 others); Thu, 30 Mar 2023 21:06:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229485AbjCaBGj (ORCPT ); Thu, 30 Mar 2023 21:06:39 -0400 Received: from out30-100.freemail.mail.aliyun.com (out30-100.freemail.mail.aliyun.com [115.124.30.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D97C7CA19; Thu, 30 Mar 2023 18:06:37 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R711e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=yang.lee@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0Vf09vE6_1680224794; Received: from localhost(mailfrom:yang.lee@linux.alibaba.com fp:SMTPD_---0Vf09vE6_1680224794) by smtp.aliyun-inc.com; Fri, 31 Mar 2023 09:06:35 +0800 From: Yang Li To: jgg@ziepe.ca Cc: leon@kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Yang Li , Abaci Robot Subject: [PATCH -next] RDMA/cma: Remove NULL check before dev_{put, hold} Date: Fri, 31 Mar 2023 09:06:33 +0800 Message-Id: <20230331010633.63261-1-yang.lee@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.7.g153144c MIME-Version: 1.0 X-Spam-Status: No, score=-8.0 required=5.0 tests=ENV_AND_HDR_SPF_MATCH, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761843946764021432?= X-GMAIL-MSGID: =?utf-8?q?1761843946764021432?= 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 warnings: ./drivers/infiniband/core/cma.c:713:2-9: WARNING: NULL check before dev_{put, hold} functions is not needed. ./drivers/infiniband/core/cma.c:2433:2-9: WARNING: NULL check before dev_{put, hold} functions is not needed. Reported-by: Abaci Robot Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=4668 Signed-off-by: Yang Li --- drivers/infiniband/core/cma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 6b9563d4f23c..93a1c48d0c32 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -709,8 +709,7 @@ cma_validate_port(struct ib_device *device, u32 port, } sgid_attr = rdma_find_gid_by_port(device, gid, gid_type, port, ndev); - if (ndev) - dev_put(ndev); + dev_put(ndev); return sgid_attr; } @@ -2429,8 +2428,7 @@ static int cma_ib_req_handler(struct ib_cm_id *cm_id, mutex_unlock(&listen_id->handler_mutex); net_dev_put: - if (net_dev) - dev_put(net_dev); + dev_put(net_dev); return ret; }