netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ionic: Remove unnecessary ternary operator in ionic_debugfs_add_ident
@ 2019-09-17 23:26 Nathan Chancellor
  2019-09-17 23:40 ` Shannon Nelson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Nathan Chancellor @ 2019-09-17 23:26 UTC (permalink / raw)
  To: Shannon Nelson, Pensando Drivers, David S. Miller
  Cc: netdev, linux-kernel, clang-built-linux, Greg Kroah-Hartman,
	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.

[1]: https://lore.kernel.org/linux-mm/20150815160730.GB25186@kroah.com/

Fixes: fbfb8031533c ("ionic: Add hardware init and device commands")
Link: https://github.com/ClangBuiltLinux/linux/issues/658
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
 drivers/net/ethernet/pensando/ionic/ionic_debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/pensando/ionic/ionic_debugfs.c b/drivers/net/ethernet/pensando/ionic/ionic_debugfs.c
index 7afc4a365b75..bc03cecf80cc 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_debugfs.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_debugfs.c
@@ -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)
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ionic: Remove unnecessary ternary operator in ionic_debugfs_add_ident
  2019-09-17 23:26 [PATCH] ionic: Remove unnecessary ternary operator in ionic_debugfs_add_ident Nathan Chancellor
@ 2019-09-17 23:40 ` Shannon Nelson
  2019-09-18  5:57 ` Greg Kroah-Hartman
  2019-09-20  0:21 ` Jakub Kicinski
  2 siblings, 0 replies; 4+ messages in thread
From: Shannon Nelson @ 2019-09-17 23:40 UTC (permalink / raw)
  To: Nathan Chancellor, Pensando Drivers, David S. Miller
  Cc: netdev, linux-kernel, clang-built-linux, Greg Kroah-Hartman


On 9/17/19 4:26 PM, Nathan Chancellor wrote:
> 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/20150815160730.GB25186@kroah.com/
>
> Fixes: fbfb8031533c ("ionic: Add hardware init and device commands")
> Link: https://github.com/ClangBuiltLinux/linux/issues/658
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>

Acked-by: Shannon Nelson <snelson@pensando.io>

> ---
>   drivers/net/ethernet/pensando/ionic/ionic_debugfs.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_debugfs.c b/drivers/net/ethernet/pensando/ionic/ionic_debugfs.c
> index 7afc4a365b75..bc03cecf80cc 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_debugfs.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_debugfs.c
> @@ -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)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ionic: Remove unnecessary ternary operator in ionic_debugfs_add_ident
  2019-09-17 23:26 [PATCH] ionic: Remove unnecessary ternary operator in ionic_debugfs_add_ident Nathan Chancellor
  2019-09-17 23:40 ` Shannon Nelson
@ 2019-09-18  5:57 ` Greg Kroah-Hartman
  2019-09-20  0:21 ` Jakub Kicinski
  2 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2019-09-18  5:57 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Shannon Nelson, Pensando Drivers, David S. Miller, netdev,
	linux-kernel, clang-built-linux

On Tue, Sep 17, 2019 at 04:26:16PM -0700, Nathan Chancellor wrote:
> 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/20150815160730.GB25186@kroah.com/
> 
> Fixes: fbfb8031533c ("ionic: Add hardware init and device commands")
> Link: https://github.com/ClangBuiltLinux/linux/issues/658
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
>  drivers/net/ethernet/pensando/ionic/ionic_debugfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ionic: Remove unnecessary ternary operator in ionic_debugfs_add_ident
  2019-09-17 23:26 [PATCH] ionic: Remove unnecessary ternary operator in ionic_debugfs_add_ident Nathan Chancellor
  2019-09-17 23:40 ` Shannon Nelson
  2019-09-18  5:57 ` Greg Kroah-Hartman
@ 2019-09-20  0:21 ` Jakub Kicinski
  2 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2019-09-20  0:21 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Shannon Nelson, Pensando Drivers, David S. Miller, netdev,
	linux-kernel, clang-built-linux, Greg Kroah-Hartman

On Tue, 17 Sep 2019 16:26:16 -0700, Nathan Chancellor wrote:
> 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/20150815160730.GB25186@kroah.com/
> 
> Fixes: fbfb8031533c ("ionic: Add hardware init and device commands")
> Link: https://github.com/ClangBuiltLinux/linux/issues/658
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>

Applied, thank you!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-09-20  0:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-17 23:26 [PATCH] ionic: Remove unnecessary ternary operator in ionic_debugfs_add_ident Nathan Chancellor
2019-09-17 23:40 ` Shannon Nelson
2019-09-18  5:57 ` Greg Kroah-Hartman
2019-09-20  0:21 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).