mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vasyl Gomonovych <gomonovych@gmail.com>
To: scott.bauer@intel.com, jonathan.derrick@intel.com,
	rafael.antognolli@intel.com, axboe@kernel.dk,
	linux-block@vger.kernel.org, gomonovych@gmail.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] block/sed-opal: Fix warnings never less than zero
Date: Mon, 11 Dec 2017 16:45:15 +0100	[thread overview]
Message-ID: <1513007115-32102-1-git-send-email-gomonovych@gmail.com> (raw)

Fixed following smatch warnings in sed-opal.c
block/sed-opal.c:2311 opal_set_new_pw()
warn: unsigned 'opal_pw->session.who' is never less than zero.

Unless enum opal_user interface will remain stable warning could be fixed
in mentioned way by removing unnecessary check

Signed-off-by: Vasyl Gomonovych <gomonovych@gmail.com>
---
 block/sed-opal.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/block/sed-opal.c b/block/sed-opal.c
index 9ed51d0c..a5f0fa2 100644
--- a/block/sed-opal.c
+++ b/block/sed-opal.c
@@ -2222,8 +2222,7 @@ static int opal_lock_unlock(struct opal_dev *dev,
 {
 	int ret;
 
-	if (lk_unlk->session.who < OPAL_ADMIN1 ||
-	    lk_unlk->session.who > OPAL_USER9)
+	if (lk_unlk->session.who > OPAL_USER9)
 		return -EINVAL;
 
 	mutex_lock(&dev->dev_lock);
@@ -2308,9 +2307,7 @@ static int opal_set_new_pw(struct opal_dev *dev, struct opal_new_pw *opal_pw)
 	};
 	int ret;
 
-	if (opal_pw->session.who < OPAL_ADMIN1 ||
-	    opal_pw->session.who > OPAL_USER9  ||
-	    opal_pw->new_user_pw.who < OPAL_ADMIN1 ||
+	if (opal_pw->session.who > OPAL_USER9  ||
 	    opal_pw->new_user_pw.who > OPAL_USER9)
 		return -EINVAL;
 
-- 
1.9.1

                 reply	other threads:[~2017-12-11 15:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1513007115-32102-1-git-send-email-gomonovych@gmail.com \
    --to=gomonovych@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=jonathan.derrick@intel.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael.antognolli@intel.com \
    --cc=scott.bauer@intel.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®