From patchwork Sat Oct 26 03:47:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhen Lei X-Patchwork-Id: 13852013 X-Patchwork-Delegate: kuba@kernel.org Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 19F2D13C9A3 for ; Sat, 26 Oct 2024 03:49:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729914554; cv=none; b=cw24eNaFvCegBfsKyaeNInuPNMT2l3KSPydT4UnxFrlRKu+spVFegMywNWWX4hP7I3WT4nyPuaXODe7dSJ+9/2lGM0v7E+KoyTDWx8Wqnv47aQ3cTG99kpORTMfX7cCo3izlteyzxnV8REXHi0g4gs43Kd9jbhOY27qYDCSlBOI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729914554; c=relaxed/simple; bh=M+vbKR/dapp5WWzfzGYRNGd+SKluD0eHn0NA3znI5Mc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qAcdOxHAsxJ/kQO9sWJQCLGJFwQKtiqrOM0/1P0XEx++XINZ0rwhL8ERgB6QPYJCmNitNiuryTM7giOOVX1BSy1lMiVONheIX3T28ufAoKiRt9EX1hodCNPdRyFOb2dS/zfYAVSak7/cGtkM8giaZXhxZOFDkIvnr+6cP27pRBs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.191 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.234]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Xb5Fg2nMJz1jvwL; Sat, 26 Oct 2024 11:47:35 +0800 (CST) Received: from dggpemf100006.china.huawei.com (unknown [7.185.36.228]) by mail.maildlp.com (Postfix) with ESMTPS id CF4F81401E9; Sat, 26 Oct 2024 11:49:01 +0800 (CST) Received: from thunder-town.china.huawei.com (10.174.178.55) by dggpemf100006.china.huawei.com (7.185.36.228) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Sat, 26 Oct 2024 11:49:01 +0800 From: Zhen Lei To: Rasesh Mody , Sudarsana Kalluru , , Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , CC: Zhen Lei Subject: [PATCH v2 1/2] bna: Remove error checking for debugfs create APIs Date: Sat, 26 Oct 2024 11:47:59 +0800 Message-ID: <20241026034800.450-2-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.37.3.windows.1 In-Reply-To: <20241026034800.450-1-thunder.leizhen@huawei.com> References: <20241026034800.450-1-thunder.leizhen@huawei.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemf100006.china.huawei.com (7.185.36.228) X-Patchwork-Delegate: kuba@kernel.org Driver bna can work fine even if any previous call to debugfs create APIs failed. All return value checks of them should be dropped, as debugfs APIs say. Signed-off-by: Zhen Lei --- drivers/net/ethernet/brocade/bna/bnad_debugfs.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bnad_debugfs.c b/drivers/net/ethernet/brocade/bna/bnad_debugfs.c index 97291bfbeea589e..220d20a829c8a84 100644 --- a/drivers/net/ethernet/brocade/bna/bnad_debugfs.c +++ b/drivers/net/ethernet/brocade/bna/bnad_debugfs.c @@ -500,19 +500,12 @@ bnad_debugfs_init(struct bnad *bnad) if (!bna_debugfs_root) { bna_debugfs_root = debugfs_create_dir("bna", NULL); atomic_set(&bna_debugfs_port_count, 0); - if (!bna_debugfs_root) { - netdev_warn(bnad->netdev, - "debugfs root dir creation failed\n"); - return; - } } /* Setup the pci_dev debugfs directory for the port */ snprintf(name, sizeof(name), "pci_dev:%s", pci_name(bnad->pcidev)); if (!bnad->port_debugfs_root) { - bnad->port_debugfs_root = - debugfs_create_dir(name, bna_debugfs_root); - + bnad->port_debugfs_root = debugfs_create_dir(name, bna_debugfs_root); atomic_inc(&bna_debugfs_port_count); for (i = 0; i < ARRAY_SIZE(bnad_debugfs_files); i++) { @@ -523,12 +516,6 @@ bnad_debugfs_init(struct bnad *bnad) bnad->port_debugfs_root, bnad, file->fops); - if (!bnad->bnad_dentry_files[i]) { - netdev_warn(bnad->netdev, - "create %s entry failed\n", - file->name); - return; - } } } } From patchwork Sat Oct 26 03:48:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhen Lei X-Patchwork-Id: 13852012 X-Patchwork-Delegate: kuba@kernel.org Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA9F913A268 for ; Sat, 26 Oct 2024 03:49:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729914547; cv=none; b=skt6Y/w8KNajlq3CAiANpBcLMYfnKoZNXdDMgODTe9/zZWis0IG32QdbusNhsD8BBBoz6kFhFNqsZW7vnQfi6FMp17ik/OSLEGGD4FZlvygM9iffYU2wMxTfGx6afkD92tJ0/nc3eGmMaKCgiQ58HcCqETcBQhFoyIC4Lswf4Ko= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729914547; c=relaxed/simple; bh=bV58mEwio2XO0wvHvMEcSvakJ3jtR6CiMs6yTMAbukA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=o+7FDl7aJUf/d9om57BmgjqCLlP1iL6GBy+6J1UJpFLvK1DwoPhBid9gGudM4CQF6uXDAVoiNFvZ3SYMMeQWAul8PnYLefw2p4y71CHuQoNQFAkgYxRPLdq2bfvqx4bEUFMUyH+asJqMttk9Mtf9IPwm8L7Ds45zQH8aOotOAPA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.190 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.163]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Xb5Fg6JlMz2Dc85; Sat, 26 Oct 2024 11:47:35 +0800 (CST) Received: from dggpemf100006.china.huawei.com (unknown [7.185.36.228]) by mail.maildlp.com (Postfix) with ESMTPS id 85B2018001B; Sat, 26 Oct 2024 11:49:02 +0800 (CST) Received: from thunder-town.china.huawei.com (10.174.178.55) by dggpemf100006.china.huawei.com (7.185.36.228) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Sat, 26 Oct 2024 11:49:01 +0800 From: Zhen Lei To: Rasesh Mody , Sudarsana Kalluru , , Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , CC: Zhen Lei Subject: [PATCH v2 2/2] bna: Remove field bnad_dentry_files[] in struct bnad Date: Sat, 26 Oct 2024 11:48:00 +0800 Message-ID: <20241026034800.450-3-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.37.3.windows.1 In-Reply-To: <20241026034800.450-1-thunder.leizhen@huawei.com> References: <20241026034800.450-1-thunder.leizhen@huawei.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemf100006.china.huawei.com (7.185.36.228) X-Patchwork-Delegate: kuba@kernel.org Function debugfs_remove() recursively removes a directory, include all files created by debugfs_create_file(). Therefore, there is no need to explicitly record each file with member ->bnad_dentry_files[] and explicitly delete them at the end. Remove field bnad_dentry_files[] and its related processing codes for simplification. Signed-off-by: Zhen Lei Reviewed-by: Simon Horman --- drivers/net/ethernet/brocade/bna/bnad.h | 1 - drivers/net/ethernet/brocade/bna/bnad_debugfs.c | 17 ++--------------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/brocade/bna/bnad.h b/drivers/net/ethernet/brocade/bna/bnad.h index 10b1e534030e628..4396997c59d041f 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.h +++ b/drivers/net/ethernet/brocade/bna/bnad.h @@ -351,7 +351,6 @@ struct bnad { /* debugfs specific data */ char *regdata; u32 reglen; - struct dentry *bnad_dentry_files[5]; struct dentry *port_debugfs_root; }; diff --git a/drivers/net/ethernet/brocade/bna/bnad_debugfs.c b/drivers/net/ethernet/brocade/bna/bnad_debugfs.c index 220d20a829c8a84..7a27f9d1443bff2 100644 --- a/drivers/net/ethernet/brocade/bna/bnad_debugfs.c +++ b/drivers/net/ethernet/brocade/bna/bnad_debugfs.c @@ -510,12 +510,8 @@ bnad_debugfs_init(struct bnad *bnad) for (i = 0; i < ARRAY_SIZE(bnad_debugfs_files); i++) { file = &bnad_debugfs_files[i]; - bnad->bnad_dentry_files[i] = - debugfs_create_file(file->name, - file->mode, - bnad->port_debugfs_root, - bnad, - file->fops); + debugfs_create_file(file->name, file->mode, + bnad->port_debugfs_root, bnad, file->fops); } } } @@ -524,15 +520,6 @@ bnad_debugfs_init(struct bnad *bnad) void bnad_debugfs_uninit(struct bnad *bnad) { - int i; - - for (i = 0; i < ARRAY_SIZE(bnad_debugfs_files); i++) { - if (bnad->bnad_dentry_files[i]) { - debugfs_remove(bnad->bnad_dentry_files[i]); - bnad->bnad_dentry_files[i] = NULL; - } - } - /* Remove the pci_dev debugfs directory for the port */ if (bnad->port_debugfs_root) { debugfs_remove(bnad->port_debugfs_root);