Skip to content

Commit

Permalink
SFH: fix error return check for -ERESTARTSYS
Browse files Browse the repository at this point in the history
Currently the check for the error return code -ERESTARTSYS is dead code
and never executed because a previous check for ret < 0 is catching this
and returning -ETIMEDOUT instead.  Fix this by checking for -ERESTARTSYS
before the more generic negative error code.

Addresses-Coverity: ("Logically dead code")
Fixes: 4b2c53d ("SFH:Transport Driver to add support of AMD Sensor Fusion Hub (SFH)")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Sandeep Singh <sandeep.singh@amd.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Colin Ian King authored and Jiri Kosina committed Nov 12, 2020
1 parent 907286d commit 6e6eae0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/hid/amd-sfh-hid/amd_sfh_hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ static int amdtp_wait_for_response(struct hid_device *hid)
ret = wait_event_interruptible_timeout(hid_data->hid_wait,
cli_data->request_done[i],
msecs_to_jiffies(AMD_SFH_RESPONSE_TIMEOUT));
if (ret < 0)
return -ETIMEDOUT;
else if (ret == -ERESTARTSYS)
if (ret == -ERESTARTSYS)
return -ERESTARTSYS;
else if (ret < 0)
return -ETIMEDOUT;
else
return 0;
}
Expand Down

0 comments on commit 6e6eae0

Please sign in to comment.