From patchwork Mon Sep 21 13:33:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 7230681 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EA8F99F32B for ; Mon, 21 Sep 2015 13:43:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2766320727 for ; Mon, 21 Sep 2015 13:43:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3703620726 for ; Mon, 21 Sep 2015 13:43:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932450AbbIUNg0 (ORCPT ); Mon, 21 Sep 2015 09:36:26 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:40457 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932347AbbIUNgW (ORCPT ); Mon, 21 Sep 2015 09:36:22 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NV100LY44GJEY30@mailout4.w1.samsung.com>; Mon, 21 Sep 2015 14:36:19 +0100 (BST) X-AuditID: cbfec7f5-f794b6d000001495-50-560007d36217 Received: from eusync3.samsung.com ( [203.254.199.213]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 94.67.05269.3D700065; Mon, 21 Sep 2015 14:36:19 +0100 (BST) Received: from AMDC1061.digital.local ([106.116.147.88]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NV100LNT4DTKI10@eusync3.samsung.com>; Mon, 21 Sep 2015 14:36:18 +0100 (BST) From: Andrzej Hajda To: linux-kernel@vger.kernel.org Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski , Kalle Valo , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH 22/38] orinoco: fix checking for default value Date: Mon, 21 Sep 2015 15:33:54 +0200 Message-id: <1442842450-29769-23-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1442842450-29769-1-git-send-email-a.hajda@samsung.com> References: <1442842450-29769-1-git-send-email-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupgluLIzCtJLcpLzFFi42I5/e/4Vd3L7AxhBrfWMVrcWneO1WLjjPWs FotWLmSzuLxrDpvFmxV32C3WHrnLbnFsgZgDu8flvl4mj74tqxg9Pm+SC2CO4rJJSc3JLEst 0rdL4Mq4cvcPe8FLnoqJf6UbGNdwdTFyckgImEjs2PaRFcIWk7hwbz1bFyMXh5DAUkaJG1/7 GSGcJiaJ9WtOs4NUsQloSvzdfJMNxBYRUJDY3PuMFaSIWeAto0Tfw2dgRcICdhILfyxn7mLk 4GARUJVY9VAYJMwr4CJx40kvC8Q2OYmTxyaDbeYEih84+AUsLiTgLHFgyRGmCYy8CxgZVjGK ppYmFxQnpeca6RUn5haX5qXrJefnbmKEhM/XHYxLj1kdYhTgYFTi4XUU+B8qxJpYVlyZe4hR goNZSYRXZxZQiDclsbIqtSg/vqg0J7X4EKM0B4uSOO/MXe9DhATSE0tSs1NTC1KLYLJMHJxS DYyyB1M3L0r+Uam/2S1Uk3dqdQhb2PK9+tu7zD2eGbz8JKGyzHvGsysVSpc+/hG1nZX9TbS9 zzhWdWr8ybxTtxyyhU5f3tLBulX3TdzBy53Jfu2SJwWX/es6kR43x5xrs+dEE87v4q/bywWP F0cx2TB/8qi9vvH5xndSXyefen4vwspJRbvstbkSS3FGoqEWc1FxIgB31TSNGwIAAA== Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Thresholds uses -1 to indicate that default value should be used. Since thresholds are unsigned sign checking makes no sense. The problem has been detected using proposed semantic patch scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2038576 Signed-off-by: Andrzej Hajda --- drivers/net/wireless/orinoco/cfg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/orinoco/cfg.c b/drivers/net/wireless/orinoco/cfg.c index a9e94b6..0f6ea31 100644 --- a/drivers/net/wireless/orinoco/cfg.c +++ b/drivers/net/wireless/orinoco/cfg.c @@ -220,7 +220,7 @@ static int orinoco_set_wiphy_params(struct wiphy *wiphy, u32 changed) if (changed & WIPHY_PARAM_FRAG_THRESHOLD) { /* Set fragmentation */ if (priv->has_mwo) { - if (wiphy->frag_threshold < 0) + if (wiphy->frag_threshold == -1) frag_value = 0; else { printk(KERN_WARNING "%s: Fixed fragmentation " @@ -230,7 +230,7 @@ static int orinoco_set_wiphy_params(struct wiphy *wiphy, u32 changed) frag_value = 1; } } else { - if (wiphy->frag_threshold < 0) + if (wiphy->frag_threshold == -1) frag_value = 2346; else if ((wiphy->frag_threshold < 257) || (wiphy->frag_threshold > 2347)) @@ -252,7 +252,7 @@ static int orinoco_set_wiphy_params(struct wiphy *wiphy, u32 changed) * the upper limit. */ - if (wiphy->rts_threshold < 0) + if (wiphy->rts_threshold == -1) rts_value = 2347; else if (wiphy->rts_threshold > 2347) err = -EINVAL;