From patchwork Mon Mar 18 17:33:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 10858375 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2B0566C2 for ; Mon, 18 Mar 2019 17:54:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0777F20246 for ; Mon, 18 Mar 2019 17:54:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0565628F6C; Mon, 18 Mar 2019 17:54:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A67D720246 for ; Mon, 18 Mar 2019 17:54:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726806AbfCRRyF (ORCPT ); Mon, 18 Mar 2019 13:54:05 -0400 Received: from gateway31.websitewelcome.com ([192.185.143.43]:35108 "EHLO gateway31.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726626AbfCRRyF (ORCPT ); Mon, 18 Mar 2019 13:54:05 -0400 X-Greylist: delayed 1258 seconds by postgrey-1.27 at vger.kernel.org; Mon, 18 Mar 2019 13:54:05 EDT Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway31.websitewelcome.com (Postfix) with ESMTP id 1862F3528 for ; Mon, 18 Mar 2019 12:33:07 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id 5w8Jh3elq4FKp5w8JhHqgT; Mon, 18 Mar 2019 12:33:07 -0500 X-Authority-Reason: nr=8 Received: from [189.250.104.39] (port=43060 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.91) (envelope-from ) id 1h5w8H-001GT6-O4; Mon, 18 Mar 2019 12:33:05 -0500 Date: Mon, 18 Mar 2019 12:33:02 -0500 From: "Gustavo A. R. Silva" To: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Daniel Drake Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH] iio: st_accel: remove unnecessary comparison of unsigned integer with < 0 Message-ID: <20190318173302.GA10761@embeddedor> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 189.250.104.39 X-Source-L: No X-Exim-ID: 1h5w8H-001GT6-O4 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedor) [189.250.104.39]:43060 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 12 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There is no need to compare *val* with < 0 because such comparison of an unsigned value is always false. Fix this by removing such comparison. Addresses-Coverity-ID: 1443919 ("Unsigned compared against 0") Fixes: f38ab20b749d ("iio: st_accel: use ACPI orientation data") Signed-off-by: Gustavo A. R. Silva --- drivers/iio/accel/st_accel_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c index a3c0916479fa..9930edf423bf 100644 --- a/drivers/iio/accel/st_accel_core.c +++ b/drivers/iio/accel/st_accel_core.c @@ -992,7 +992,7 @@ static int apply_acpi_orientation(struct iio_dev *indio_dev, goto out; val = elements[i].integer.value; - if (val < 0 || val > 2) + if (val > 2) goto out; /* Avoiding full matrix multiplication, we simply reorder the