Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752633AbdLKPpa (ORCPT ); Mon, 11 Dec 2017 10:45:30 -0500 Received: from mail-lf0-f65.google.com ([209.85.215.65]:43091 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752273AbdLKPp1 (ORCPT ); Mon, 11 Dec 2017 10:45:27 -0500 X-Google-Smtp-Source: ACJfBotppRiKLTaoXjT8e1arYrxeb/Utc+u7GfbVxgXOUIsUxnuQUTC2Kt34wslkrfCKQ5l1B5O+aw== From: Vasyl Gomonovych 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 Message-Id: <1513007115-32102-1-git-send-email-gomonovych@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1176 Lines: 39 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 --- 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