Skip to content

Commit a3c1185

Browse files
committed
Merge branch 'bna-remove-error-checking-for-debugfs-create-apis'
Zhen Lei says: ==================== bna: Remove error checking for debugfs create APIs 1. Fix the incorrect return value check for debugfs_create_dir() and debugfs_create_file(), which returns ERR_PTR(-ERROR) instead of NULL when it fails. 2. Remove field bnad_dentry_files[] in struct bnad. When a directory is deleted, files in the directory are automatically deleted. Therefore, there is need to record these files. ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents bd03e76 + 67826db commit a3c1185

File tree

2 files changed

+5
-27
lines changed

2 files changed

+5
-27
lines changed

drivers/net/ethernet/brocade/bna/bnad.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,6 @@ struct bnad {
351351
/* debugfs specific data */
352352
char *regdata;
353353
u32 reglen;
354-
struct dentry *bnad_dentry_files[5];
355354
struct dentry *port_debugfs_root;
356355
};
357356

drivers/net/ethernet/brocade/bna/bnad_debugfs.c

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -500,11 +500,6 @@ bnad_debugfs_init(struct bnad *bnad)
500500
if (!bna_debugfs_root) {
501501
bna_debugfs_root = debugfs_create_dir("bna", NULL);
502502
atomic_set(&bna_debugfs_port_count, 0);
503-
if (!bna_debugfs_root) {
504-
netdev_warn(bnad->netdev,
505-
"debugfs root dir creation failed\n");
506-
return;
507-
}
508503
}
509504

510505
/* Setup the pci_dev debugfs directory for the port */
@@ -517,18 +512,11 @@ bnad_debugfs_init(struct bnad *bnad)
517512

518513
for (i = 0; i < ARRAY_SIZE(bnad_debugfs_files); i++) {
519514
file = &bnad_debugfs_files[i];
520-
bnad->bnad_dentry_files[i] =
521-
debugfs_create_file(file->name,
522-
file->mode,
523-
bnad->port_debugfs_root,
524-
bnad,
525-
file->fops);
526-
if (!bnad->bnad_dentry_files[i]) {
527-
netdev_warn(bnad->netdev,
528-
"create %s entry failed\n",
529-
file->name);
530-
return;
531-
}
515+
debugfs_create_file(file->name,
516+
file->mode,
517+
bnad->port_debugfs_root,
518+
bnad,
519+
file->fops);
532520
}
533521
}
534522
}
@@ -537,15 +525,6 @@ bnad_debugfs_init(struct bnad *bnad)
537525
void
538526
bnad_debugfs_uninit(struct bnad *bnad)
539527
{
540-
int i;
541-
542-
for (i = 0; i < ARRAY_SIZE(bnad_debugfs_files); i++) {
543-
if (bnad->bnad_dentry_files[i]) {
544-
debugfs_remove(bnad->bnad_dentry_files[i]);
545-
bnad->bnad_dentry_files[i] = NULL;
546-
}
547-
}
548-
549528
/* Remove the pci_dev debugfs directory for the port */
550529
if (bnad->port_debugfs_root) {
551530
debugfs_remove(bnad->port_debugfs_root);

0 commit comments

Comments
 (0)