]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
audit: remove redundant initialization of static variables to 0
authorRicardo Robaina <rrobaina@redhat.com>
Thu, 26 Feb 2026 18:13:38 +0000 (15:13 -0300)
committerPaul Moore <paul@paul-moore.com>
Mon, 2 Mar 2026 21:40:36 +0000 (16:40 -0500)
Static variables are automatically initialized to 0 by the compiler.
Remove the redundant explicit assignments in kernel/audit.c to clean
up the code, align with standard kernel coding style, and fix the
following checkpatch.pl errors:

 ./scripts/checkpatch.pl kernel/audit.c | grep -A2 ERROR:
 ERROR: do not initialise statics to 0
 + static unsigned long last_check = 0;
 --
 ERROR: do not initialise statics to 0
 + static int messages   = 0;
 --
 ERROR: do not initialise statics to 0
 + static unsigned long last_msg = 0;

Signed-off-by: Ricardo Robaina <rrobaina@redhat.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
kernel/audit.c

index 5a021605652498bb1d132fcab4d43292e9357216..08793e71b9759dffe3b9ad65f805ba9d9d1c7a8f 100644 (file)
@@ -355,8 +355,8 @@ void audit_panic(const char *message)
 
 static inline int audit_rate_check(void)
 {
-       static unsigned long    last_check = 0;
-       static int              messages   = 0;
+       static unsigned long    last_check;
+       static int              messages;
        static DEFINE_SPINLOCK(lock);
        unsigned long           flags;
        unsigned long           now;
@@ -391,7 +391,7 @@ static inline int audit_rate_check(void)
 */
 void audit_log_lost(const char *message)
 {
-       static unsigned long    last_msg = 0;
+       static unsigned long    last_msg;
        static DEFINE_SPINLOCK(lock);
        unsigned long           flags;
        unsigned long           now;