Re: [PATCH 04/17] locking/semaphore: assert static storage for DEFINE_SEMAPHORE()

From: sashiko-bot

Date: Mon Sep 14 2026 - 23:30:18 EST


> DEFINE_SEMAPHORE() statically initializes its embedded raw spinlock.
> Using it for an automatic local semaphore leaves lockdep without a
> persistent class key.
>
> Reject this use with ASSERT_STATIC_STORAGE(). Automatic semaphores must
> use sema_init(), which supplies a static class key. Preserve the underlying
> initializer used by sema_init() and by embedded objects.
>
> Assisted-by: OpenAI Codex
> Signed-off-by: Yury Norov <ynorov@xxxxxxxxxx>

Sashiko has reviewed this patch and found no issues. It looks great!

--
Sashiko AI review · https://sashiko.dev/#/patchset/20260915030336.1192299-1-ynorov@xxxxxxxxxx?part=4