Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp386945rwl; Thu, 30 Mar 2023 18:09:00 -0700 (PDT) X-Google-Smtp-Source: AKy350biJYgfiqX/gqnWTRvt7R7znrt8TFc7YH4Nx7QyVxiB+9+BfnDHVJVJleG0Ikg501Vltm01 X-Received: by 2002:a17:90a:ea15:b0:23f:4e68:b860 with SMTP id w21-20020a17090aea1500b0023f4e68b860mr4078281pjy.3.1680224940450; Thu, 30 Mar 2023 18:09:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680224940; cv=none; d=google.com; s=arc-20160816; b=pAhFKXlzeWtZsbNiOrmKd6GVtEwNkJ9GMNBhSO1Elery+/UWe5amQgH0Mt3ZGujMau vOv/tUe5UzhDG0z01E/r/pN4n8kAKSXxRQvHN/CX+NqW9F/u4qSMVGxLkZtA5UHriKEA mE8t4/wfJ85Q0SnGm151OZuaTX2cDaCdOOMiPnk3H1zDC3tCnPnHrAjR0bVLROHljOHb PoncV2eQCe3O5dT7Abc2sOmFTFjpsa/k/Qe9tJzrAKjSbd2z9ArMt8llZK6XBJRtDGUQ 6AlDzbROB+UQdnEweMKQ8lAOPebBmwldaAd8kV+4vOtaRHo2lW1df/v2Vmi8b+4yf+ZD wF5Q== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a29-20020a630b5d000000b005134680e477si809268pgl.499.2023.03.30.18.08.48; Thu, 30 Mar 2023 18:09:00 -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 S229588AbjCaBGk (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 Content-Transfer-Encoding: 8bit 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 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; } -- 2.20.1.7.g153144c