mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Walter Harms <wharms@bfs.de>
To: Colin King <colin.king@canonical.com>,
	Nehal Shah <nehal-bakulchandra.shah@amd.com>,
	Sandeep Singh <sandeep.singh@amd.com>,
	Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>
Cc: "kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: AW: [PATCH][next] SFH: fix error return check for -ERESTARTSYS
Date: Fri, 30 Oct 2020 14:40:16 +0000	[thread overview]
Message-ID: <7f7ed9ecdd05422ab83e0c08918063bc@bfs.de> (raw)
In-Reply-To: <20201030143002.535531-1-colin.king@canonical.com>

nit picking:
i would  without "else" to improve readability:

       if (ret == -ERESTARTSYS)
                 return -ERESTARTSYS;

        if (ret < 0)
              return -ETIMEDOUT;

          return 0;

jm2c
 wh
________________________________________
Von: Colin King <colin.king@canonical.com>
Gesendet: Freitag, 30. Oktober 2020 15:30:02
An: Nehal Shah; Sandeep Singh; Jiri Kosina; Benjamin Tissoires; linux-input@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org; linux-kernel@vger.kernel.org
Betreff: [PATCH][next] SFH: fix error return check for -ERESTARTSYS

From: Colin Ian King <colin.king@canonical.com>

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 <colin.king@canonical.com>
---
 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


  reply	other threads:[~2020-10-30 14:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-30 14:30 Colin King
2020-10-30 14:40 ` Walter Harms [this message]
2020-11-09 17:08 ` Singh, Sandeep
2020-11-12 15:27 ` Jiri Kosina

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7f7ed9ecdd05422ab83e0c08918063bc@bfs.de \
    --to=wharms@bfs.de \
    --cc=benjamin.tissoires@redhat.com \
    --cc=colin.king@canonical.com \
    --cc=jikos@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nehal-bakulchandra.shah@amd.com \
    --cc=sandeep.singh@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®