Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1415629 > unrolled thread

[PATCH] fsnotify: do not initialise statics to false

Started byWei Tang <tangwei@cmss.chinamobile.com>
First post2016-06-07 04:30 +0200
Last post2016-06-07 08:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] fsnotify: do not initialise statics to false Wei Tang <tangwei@cmss.chinamobile.com> - 2016-06-07 04:30 +0200
    Re: [PATCH] fsnotify: do not initialise statics to false Nikolay Borisov <kernel@kyup.com> - 2016-06-07 08:50 +0200

#1415629 — [PATCH] fsnotify: do not initialise statics to false

FromWei Tang <tangwei@cmss.chinamobile.com>
Date2016-06-07 04:30 +0200
Subject[PATCH] fsnotify: do not initialise statics to false
Message-ID<rHeWd-53P-3@gated-at.bofh.it>
This patch fixes the checkpatch.pl error to inotify_fsnotify.c:

ERROR: do not initialise statics to false

Signed-off-by: Wei Tang <tangwei@cmss.chinamobile.com>
---
 fs/notify/inotify/inotify_fsnotify.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c
index 2cd900c..09c5393 100644
--- a/fs/notify/inotify/inotify_fsnotify.c
+++ b/fs/notify/inotify/inotify_fsnotify.c
@@ -136,7 +136,7 @@ static int idr_callback(int id, void *p, void *data)
 {
 	struct fsnotify_mark *fsn_mark;
 	struct inotify_inode_mark *i_mark;
-	static bool warned = false;
+	static bool warned;
 
 	if (warned)
 		return 0;
-- 
1.9.1

[toc] | [next] | [standalone]


#1415755

FromNikolay Borisov <kernel@kyup.com>
Date2016-06-07 08:50 +0200
Message-ID<rHiZP-7Do-5@gated-at.bofh.it>
In reply to#1415629

On 06/07/2016 05:17 AM, Wei Tang wrote:
> This patch fixes the checkpatch.pl error to inotify_fsnotify.c:
> 
> ERROR: do not initialise statics to false

So if a variable is declared as static this means it's going to live in
the BSS which is zeroed out on load. So implicitly it is going to be 0,
however I think this is a subtle detail. I personally rather have the
false there and live with the warning. Not everything that checkpatch
reports must be fixed.


> 
> Signed-off-by: Wei Tang <tangwei@cmss.chinamobile.com>
> ---
>  fs/notify/inotify/inotify_fsnotify.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c
> index 2cd900c..09c5393 100644
> --- a/fs/notify/inotify/inotify_fsnotify.c
> +++ b/fs/notify/inotify/inotify_fsnotify.c
> @@ -136,7 +136,7 @@ static int idr_callback(int id, void *p, void *data)
>  {
>  	struct fsnotify_mark *fsn_mark;
>  	struct inotify_inode_mark *i_mark;
> -	static bool warned = false;
> +	static bool warned;
>  
>  	if (warned)
>  		return 0;
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web