mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-30 06:56:46 +07:00
bnxt: no need to check return value of debugfs_create functions
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. This cleans up a lot of unneeded code and logic around the debugfs files, making all of this much simpler and easier to understand. Cc: Michael Chan <michael.chan@broadcom.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: netdev@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
9e3926df87
commit
3a131e8504
@ -1724,7 +1724,6 @@ struct bnxt {
|
|||||||
u8 switch_id[8];
|
u8 switch_id[8];
|
||||||
struct bnxt_tc_info *tc_info;
|
struct bnxt_tc_info *tc_info;
|
||||||
struct dentry *debugfs_pdev;
|
struct dentry *debugfs_pdev;
|
||||||
struct dentry *debugfs_dim;
|
|
||||||
struct device *hwmon_dev;
|
struct device *hwmon_dev;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -61,45 +61,30 @@ static const struct file_operations debugfs_dim_fops = {
|
|||||||
.read = debugfs_dim_read,
|
.read = debugfs_dim_read,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct dentry *debugfs_dim_ring_init(struct dim *dim, int ring_idx,
|
static void debugfs_dim_ring_init(struct dim *dim, int ring_idx,
|
||||||
struct dentry *dd)
|
struct dentry *dd)
|
||||||
{
|
{
|
||||||
static char qname[16];
|
static char qname[16];
|
||||||
|
|
||||||
snprintf(qname, 10, "%d", ring_idx);
|
snprintf(qname, 10, "%d", ring_idx);
|
||||||
return debugfs_create_file(qname, 0600, dd,
|
debugfs_create_file(qname, 0600, dd, dim, &debugfs_dim_fops);
|
||||||
dim, &debugfs_dim_fops);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void bnxt_debug_dev_init(struct bnxt *bp)
|
void bnxt_debug_dev_init(struct bnxt *bp)
|
||||||
{
|
{
|
||||||
const char *pname = pci_name(bp->pdev);
|
const char *pname = pci_name(bp->pdev);
|
||||||
struct dentry *pdevf;
|
struct dentry *dir;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
bp->debugfs_pdev = debugfs_create_dir(pname, bnxt_debug_mnt);
|
bp->debugfs_pdev = debugfs_create_dir(pname, bnxt_debug_mnt);
|
||||||
if (bp->debugfs_pdev) {
|
dir = debugfs_create_dir("dim", bp->debugfs_pdev);
|
||||||
pdevf = debugfs_create_dir("dim", bp->debugfs_pdev);
|
|
||||||
if (!pdevf) {
|
|
||||||
pr_err("failed to create debugfs entry %s/dim\n",
|
|
||||||
pname);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
bp->debugfs_dim = pdevf;
|
|
||||||
/* create files for each rx ring */
|
|
||||||
for (i = 0; i < bp->cp_nr_rings; i++) {
|
|
||||||
struct bnxt_cp_ring_info *cpr = &bp->bnapi[i]->cp_ring;
|
|
||||||
|
|
||||||
if (cpr && bp->bnapi[i]->rx_ring) {
|
/* create files for each rx ring */
|
||||||
pdevf = debugfs_dim_ring_init(&cpr->dim, i,
|
for (i = 0; i < bp->cp_nr_rings; i++) {
|
||||||
bp->debugfs_dim);
|
struct bnxt_cp_ring_info *cpr = &bp->bnapi[i]->cp_ring;
|
||||||
if (!pdevf)
|
|
||||||
pr_err("failed to create debugfs entry %s/dim/%d\n",
|
if (cpr && bp->bnapi[i]->rx_ring)
|
||||||
pname, i);
|
debugfs_dim_ring_init(&cpr->dim, i, dir);
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
pr_err("failed to create debugfs entry %s\n", pname);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,8 +99,6 @@ void bnxt_debug_dev_exit(struct bnxt *bp)
|
|||||||
void bnxt_debug_init(void)
|
void bnxt_debug_init(void)
|
||||||
{
|
{
|
||||||
bnxt_debug_mnt = debugfs_create_dir("bnxt_en", NULL);
|
bnxt_debug_mnt = debugfs_create_dir("bnxt_en", NULL);
|
||||||
if (!bnxt_debug_mnt)
|
|
||||||
pr_err("failed to init bnxt_en debugfs\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void bnxt_debug_exit(void)
|
void bnxt_debug_exit(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user