From nobody Tue Dec 16 16:41:30 2025 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 6A909C7618E for ; Sat, 22 Apr 2023 16:00:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229612AbjDVQAQ (ORCPT ); Sat, 22 Apr 2023 12:00:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229580AbjDVQAN (ORCPT ); Sat, 22 Apr 2023 12:00:13 -0400 Received: from hust.edu.cn (mail.hust.edu.cn [202.114.0.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DACE1705 for ; Sat, 22 Apr 2023 09:00:12 -0700 (PDT) Received: from uu22.. ([10.12.190.56]) (user=dddddd@hust.edu.cn mech=LOGIN bits=0) by mx1.hust.edu.cn with ESMTP id 33MFwu2V023768-33MFwu2W023768 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 22 Apr 2023 23:58:57 +0800 From: Yinhao Hu To: Dave Jiang , Jon Mason , Allen Hubbe Cc: hust-os-kernel-patches@googlegroups.com, Yinhao Hu , Dongliang Mu , ntb@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH] ntb: hw: intel: remove return value check of `ndev_init_debugfs` Date: Sat, 22 Apr 2023 23:56:34 +0800 Message-Id: <20230422155634.483023-1-dddddd@hust.edu.cn> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-FEAS-AUTH-USER: dddddd@hust.edu.cn Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Smatch complains that: ndev_init_debugfs() warn: 'ndev->debugfs_dir' is an error pointer or valid Debugfs checks are generally not supposed to be checked for errors and it is not necessary here. Just delete the dead code. Signed-off-by: Yinhao Hu Reviewed-by: Dongliang Mu --- The issue is found by static analysis and remains untested. --- drivers/ntb/hw/intel/ntb_hw_gen1.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/ntb/hw/intel/ntb_hw_gen1.c b/drivers/ntb/hw/intel/ntb_= hw_gen1.c index 9ab836d0d4f1..9b0b2c43f1bb 100644 --- a/drivers/ntb/hw/intel/ntb_hw_gen1.c +++ b/drivers/ntb/hw/intel/ntb_hw_gen1.c @@ -778,13 +778,10 @@ static void ndev_init_debugfs(struct intel_ntb_dev *n= dev) ndev->debugfs_dir =3D debugfs_create_dir(pci_name(ndev->ntb.pdev), debugfs_dir); - if (!ndev->debugfs_dir) - ndev->debugfs_info =3D NULL; - else - ndev->debugfs_info =3D - debugfs_create_file("info", S_IRUSR, - ndev->debugfs_dir, ndev, - &intel_ntb_debugfs_info); + ndev->debugfs_info =3D + debugfs_create_file("info", S_IRUSR, + ndev->debugfs_dir, ndev, + &intel_ntb_debugfs_info); } } =20 --=20 2.34.1