Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1324691pxx; Fri, 30 Oct 2020 07:32:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxa/8vOnkcjO/O4iNt7/ptAct+cqm5lzTjkbHxoAo3jxmobWo7JwnWTO6I8o2VaJ7JeIsHe X-Received: by 2002:a17:906:53d6:: with SMTP id p22mr2691605ejo.517.1604068346497; Fri, 30 Oct 2020 07:32:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604068346; cv=none; d=google.com; s=arc-20160816; b=kmqb1BRw/94TmYzcAvXrN15PKIplbPuf0Iz8WVXeaJyMwAfBzLiMOOFny2MSEnabT+ Db74JLPIQ5H5W0XfZKNCx322uVyDaf7wzRBjRGY1eZ5tqnfeHuOb9PXkG+SRtmEb6vJe Cs2Apngos8rn9IVvNS5MIEP/cQgV7tr3SyNcE3O8bYaGW1Wdjtr8wMpNsk8Dj44Wbm8O 2+XsXoQqH/0kcMiakV2RWjsaAUxNXtL9JJFRjFtivLzx2cbX59siBO3vUxUAi+gbxymR qRbPhES98ga425IlBwSN9M7aLWjG4+n6xA0ldNhH7RJOT3BtY8tgF9wVPHllE4UwrzYm ZyAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=8lvkMoU0CtlkpRMLd952skpojpPPc3zxKyLhxmjaXAQ=; b=elzRRezxCwqrik8ycnBguHton0k/7wx5c8Ahu+ByMhtdPA/D2GBvIjBWp8EDZRoWcV Ii0fWqzyf93CfZ8Kp8GviPozNeHEdUn3ykrpYLwcVBM9IW51idxeZ4M1b86TMP+ZV5MH jC6TuypEgXwQq0L7vXOKjX7C+rgh5sdYaT48HFpuz1zwtdWB0KlW7E1b2Lz8FxHnWUgj 3XiXTJjc76wKe5HO8VCCbyJVlmNvx1avy+43Uce94BaoFfRMy0dUiZjxItYqfViW+xiF Mnncag3yucFV4U+xogOaO4ClkA4eopqEhrXfHWUQL2443fTge98CgQ5ytI7CS6P3mzGO 4kDQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e20si4253987eja.480.2020.10.30.07.32.03; Fri, 30 Oct 2020 07:32:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726739AbgJ3OaI (ORCPT + 99 others); Fri, 30 Oct 2020 10:30:08 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:43735 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725834AbgJ3OaH (ORCPT ); Fri, 30 Oct 2020 10:30:07 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kYVPm-00085E-Kr; Fri, 30 Oct 2020 14:30:02 +0000 From: Colin King To: Nehal Shah , Sandeep Singh , Jiri Kosina , Benjamin Tissoires , linux-input@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] SFH: fix error return check for -ERESTARTSYS Date: Fri, 30 Oct 2020 14:30:02 +0000 Message-Id: <20201030143002.535531-1-colin.king@canonical.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King 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: 4b2c53d93a4b ("SFH:Transport Driver to add support of AMD Sensor Fusion Hub (SFH)") Signed-off-by: Colin Ian King --- drivers/hid/amd-sfh-hid/amd_sfh_hid.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_hid.c b/drivers/hid/amd-sfh-hid/amd_sfh_hid.c index a471079a3bd0..4f989483aa03 100644 --- a/drivers/hid/amd-sfh-hid/amd_sfh_hid.c +++ b/drivers/hid/amd-sfh-hid/amd_sfh_hid.c @@ -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; } -- 2.27.0