Skip to content

Commit a6053fe

Browse files
rprobainapcmoore
authored andcommitted
audit: remove redundant initialization of static variables to 0
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>
1 parent f6c2996 commit a6053fe

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

kernel/audit.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,8 @@ void audit_panic(const char *message)
355355

356356
static inline int audit_rate_check(void)
357357
{
358-
static unsigned long last_check = 0;
359-
static int messages = 0;
358+
static unsigned long last_check;
359+
static int messages;
360360
static DEFINE_SPINLOCK(lock);
361361
unsigned long flags;
362362
unsigned long now;
@@ -391,7 +391,7 @@ static inline int audit_rate_check(void)
391391
*/
392392
void audit_log_lost(const char *message)
393393
{
394-
static unsigned long last_msg = 0;
394+
static unsigned long last_msg;
395395
static DEFINE_SPINLOCK(lock);
396396
unsigned long flags;
397397
unsigned long now;

0 commit comments

Comments
 (0)