Skip to contentSkip to conversation

ionic: Remove unnecessary ternary operator in ionic_debugfs_add_ident

PATCH Applied Nathan Chancellor 4 participants 4 messages Sep 17, 2019 – Sep 20, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ionic: Remove unnecessary ternary operator in ionic_debugfs_add_ident

clang warns:

../drivers/net/ethernet/pensando/ionic/ionic_debugfs.c:60:37: warning:
expression result unused [-Wunused-value]

                            ionic, &identity_fops) ? 0 : -EOPNOTSUPP;
                                                         ^~~~~~~~~~~

1 warning generated.

The return value of debugfs_create_file does not need to be checked [1] and the function returns void so get rid of the ternary operator, it is unnecessary.

[1]: https://lore.kernel.org/linux-mm/[email protected]/

Fixes fbfb8031533c ("ionic: Add hardware init and device commands")
---
 drivers/net/ethernet/pensando/ionic/ionic_debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/pensando/ionic/ionic_debugfs.c +1 -1
index 7afc4a365b75..bc03cecf80cc 100644
@@ -57,7 +57,7 @@ DEFINE_SHOW_ATTRIBUTE(identity);
 void ionic_debugfs_add_ident(struct ionic *ionic)
 {
 	debugfs_create_file("identity", 0400, ionic->dentry,
-			    ionic, &identity_fops) ? 0 : -EOPNOTSUPP;
+			    ionic, &identity_fops);
 }
 
 void ionic_debugfs_add_sizes(struct ionic *ionic)
Signature · 1 line
2.23.0
Acked-by on v1 1/1
#1 lore raw
Quoted 12 lines · Nathan Chancellor

clang warns:

../drivers/net/ethernet/pensando/ionic/ionic_debugfs.c:60:37: warning:
expression result unused [-Wunused-value]

                             ionic, &identity_fops) ? 0 : -EOPNOTSUPP;
                                                          ^~~~~~~~~~~

1 warning generated.

The return value of debugfs_create_file does not need to be checked [1] and the function returns void so get rid of the ternary operator, it is unnecessary.

Quoted 5 lines

[1]: https://lore.kernel.org/linux-mm/[email protected]/

Fixes fbfb8031533c ("ionic: Add hardware init and device commands")
Quoted 17 lines
---
  drivers/net/ethernet/pensando/ionic/ionic_debugfs.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/pensando/ionic/ionic_debugfs.c +1 -1
index 7afc4a365b75..bc03cecf80cc 100644
@@ -57,7 +57,7 @@ DEFINE_SHOW_ATTRIBUTE(identity);
  void ionic_debugfs_add_ident(struct ionic *ionic)
  {
  	debugfs_create_file("identity", 0400, ionic->dentry,
-			    ionic, &identity_fops) ? 0 : -EOPNOTSUPP;
+			    ionic, &identity_fops);
  }
 
  void ionic_debugfs_add_sizes(struct ionic *ionic)
Reviewed-by on v1 1/1
#2 lore raw
In reply to Nathan Chancellor
Quoted 12 lines · Nathan Chancellor

clang warns:

../drivers/net/ethernet/pensando/ionic/ionic_debugfs.c:60:37: warning:
expression result unused [-Wunused-value]

                            ionic, &identity_fops) ? 0 : -EOPNOTSUPP;
                                                         ^~~~~~~~~~~

1 warning generated.

The return value of debugfs_create_file does not need to be checked [1] and the function returns void so get rid of the ternary operator, it is unnecessary.

Quoted 8 lines

[1]: https://lore.kernel.org/linux-mm/[email protected]/

Fixes fbfb8031533c ("ionic: Add hardware init and device commands")
---
 drivers/net/ethernet/pensando/ionic/ionic_debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#3 lore raw
In reply to Nathan Chancellor
Quoted 12 lines · Nathan Chancellor

clang warns:

../drivers/net/ethernet/pensando/ionic/ionic_debugfs.c:60:37: warning:
expression result unused [-Wunused-value]

                            ionic, &identity_fops) ? 0 : -EOPNOTSUPP;
                                                         ^~~~~~~~~~~

1 warning generated.

The return value of debugfs_create_file does not need to be checked [1] and the function returns void so get rid of the ternary operator, it is unnecessary.

Quoted 5 lines

[1]: https://lore.kernel.org/linux-mm/[email protected]/

Fixes fbfb8031533c ("ionic: Add hardware init and device commands")

Applied, thank you!