mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 05:04:02 +02:00
HID: amd_sfh: return an error when response wait times out
amdtp_wait_for_response() waits for request_done before completing a report request. wait_event_interruptible_timeout() returns 0 when the wait expires, but the current code treats only negative values as errors and returns success on timeout. Return -ETIMEDOUT when the response wait expires while preserving the existing success path when the response has already been observed. Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn> Acked-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
This commit is contained in:
parent
6bad2e38fe
commit
336af689d5
|
|
@ -87,16 +87,17 @@ static int amdtp_wait_for_response(struct hid_device *hid)
|
|||
break;
|
||||
}
|
||||
|
||||
if (!cli_data->request_done[i])
|
||||
if (!cli_data->request_done[i]) {
|
||||
ret = wait_event_interruptible_timeout(hid_data->hid_wait,
|
||||
cli_data->request_done[i],
|
||||
msecs_to_jiffies(AMD_SFH_RESPONSE_TIMEOUT));
|
||||
if (ret == -ERESTARTSYS)
|
||||
return -ERESTARTSYS;
|
||||
else if (ret < 0)
|
||||
return -ETIMEDOUT;
|
||||
else
|
||||
return 0;
|
||||
if (ret == -ERESTARTSYS)
|
||||
return -ERESTARTSYS;
|
||||
if (ret <= 0)
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void amdtp_hid_wakeup(struct hid_device *hid)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user