diff mbox series

[v2,1/2] bna: Remove error checking for debugfs create APIs

Message ID 20241026034800.450-2-thunder.leizhen@huawei.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series bna: Remove error checking for debugfs create APIs | expand

Checks

Context Check Description
netdev/series_format warning Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 5 this patch: 5
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/build_clang success Errors and warnings before: 3 this patch: 3
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 4 this patch: 4
netdev/checkpatch warning WARNING: line length of 85 exceeds 80 columns
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Leizhen (ThunderTown) Oct. 26, 2024, 3:47 a.m. UTC
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 <thunder.leizhen@huawei.com>
---
 drivers/net/ethernet/brocade/bna/bnad_debugfs.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

Comments

Simon Horman Oct. 26, 2024, 3:35 p.m. UTC | #1
On Sat, Oct 26, 2024 at 11:47:59AM +0800, Zhen Lei wrote:
> 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 <thunder.leizhen@huawei.com>
> ---
>  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);

nit: This change seems to only change line wrapping from <= 80 columns wide
     (still preferred for Networking code) to > 80 columns wide (not so good).

     Probably this part of the patch should be removed.
     If not, reworked so it is <= 80 columns wide.

Otherwise, this patch looks good to me.

>  		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;
> -			}
>  		}
>  	}
>  }
Leizhen (ThunderTown) Oct. 28, 2024, 1:56 a.m. UTC | #2
On 2024/10/26 23:35, Simon Horman wrote:
> On Sat, Oct 26, 2024 at 11:47:59AM +0800, Zhen Lei wrote:
>> 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 <thunder.leizhen@huawei.com>
>> ---
>>  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);
> 
> nit: This change seems to only change line wrapping from <= 80 columns wide
>      (still preferred for Networking code) to > 80 columns wide (not so good).
> 
>      Probably this part of the patch should be removed.
>      If not, reworked so it is <= 80 columns wide.

Okay, I'll revert this one.

> 
> Otherwise, this patch looks good to me.

then add: Reviewed-by: Simon Horman <horms@kernel.org>

> 
>>  		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;
>> -			}
>>  		}
>>  	}
>>  }
>
diff mbox series

Patch

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;
-			}
 		}
 	}
 }