diff options
author | Zihuan Zhang <zhangzihuan@kylinos.cn> | 2025-05-09 10:25:54 +0800 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.com> | 2025-06-10 21:43:24 +0200 |
commit | d3db1ce9bf8f4a8e03d3bd19000b32290bca7d74 (patch) | |
tree | 61b93aa2e84ee4e3b9dbc5d60809ebc1f053fa68 | |
parent | 2043ae9019e0f75c7785048230586c3f3ca0a2a4 (diff) |
HID: debug: Use the __set_current_state()
When detecting an invalid list->hdev, the process needs to manually set
its state to TASK_RUNNING and exit. In the original code,
set_current_state() (which includes a memory barrier) is used here, but
it is immediately followed by a mutex_unlock() call. Since
mutex_unlock() internally includes a memory barrier, this ensures that
all modifications within the critical section (including the process
state) are visible to other CPUs. Therefore, replacing it with
__set_current_state() (without an implicit barrier) avoids redundant
memory barriers.
Signed-off-by: Zihuan Zhang <zhangzihuan@kylinos.cn>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
-rw-r--r-- | drivers/hid/hid-debug.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c index 8433306148d5..00a73983ef19 100644 --- a/drivers/hid/hid-debug.c +++ b/drivers/hid/hid-debug.c @@ -3726,7 +3726,7 @@ static ssize_t hid_debug_events_read(struct file *file, char __user *buffer, */ if (!list->hdev || !list->hdev->debug) { ret = -EIO; - set_current_state(TASK_RUNNING); + __set_current_state(TASK_RUNNING); goto out; } |