]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
kcov: Use scoped init guard
authorMarco Elver <elver@google.com>
Mon, 19 Jan 2026 09:05:53 +0000 (10:05 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Wed, 28 Jan 2026 19:45:24 +0000 (20:45 +0100)
Convert lock initialization to scoped guarded initialization where
lock-guarded members are initialized in the same scope.

This ensures the context analysis treats the context as active during
member initialization. This is required to avoid errors once implicit
context assertion is removed.

Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260119094029.1344361-4-elver@google.com
kernel/kcov.c

index 6cbc6e2d8aeeb0b89be6a90adb3dfffa41763acb..5397d0c14127bcd3f30eceae7b10a5d2a89ab56f 100644 (file)
@@ -530,7 +530,7 @@ static int kcov_open(struct inode *inode, struct file *filep)
        kcov = kzalloc(sizeof(*kcov), GFP_KERNEL);
        if (!kcov)
                return -ENOMEM;
-       spin_lock_init(&kcov->lock);
+       guard(spinlock_init)(&kcov->lock);
        kcov->mode = KCOV_MODE_DISABLED;
        kcov->sequence = 1;
        refcount_set(&kcov->refcount, 1);