Skip to content

Commit d3db1ce

Browse files
Zihuan ZhangJiri Kosina
authored andcommitted
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 <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 2043ae9 commit d3db1ce

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/hid/hid-debug.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3726,7 +3726,7 @@ static ssize_t hid_debug_events_read(struct file *file, char __user *buffer,
37263726
*/
37273727
if (!list->hdev || !list->hdev->debug) {
37283728
ret = -EIO;
3729-
set_current_state(TASK_RUNNING);
3729+
__set_current_state(TASK_RUNNING);
37303730
goto out;
37313731
}
37323732

0 commit comments

Comments
 (0)