From patchwork Sun Oct 8 19:30:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christos Gkekas X-Patchwork-Id: 9991975 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 595F060231 for ; Sun, 8 Oct 2017 19:31:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 493A6285D3 for ; Sun, 8 Oct 2017 19:31:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3DEAF285D5; Sun, 8 Oct 2017 19:31:09 +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=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A9349285D3 for ; Sun, 8 Oct 2017 19:31:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=hhdVWom013Dk9kU70yU5TxLHJkyHLXRFP3Ehmx2Fqn4=; b=QPf B3eFmjfqDPwiBGplx91lFNqcbuwUYLYDqeMwtBrzhbbZdIO/JWUADiBmst1J5DUvod6lQ+76Z8Hsf QHqKR8sV9JM/SIiSUqKEdxdFBDIyBUoKW1+9IfL5bJi1K2QDiy4IACpKUQ7ef6w6nCP7jB2Tuwebt mC0eNUXzbh8+3t1o0hWNIWtsU/Q5fj8r7HzgqJIXBKViaiC3GVjoTZcbIzm7+9rp+ztomQQ/i6CkP HcmgWv0teK9lKqixFygHIzJlLJ5jF8zoEsQjB38ZcBOjE6ClGCh6XBs8dg+Ei9Ej6zNo+QdFpfJRh dRqam+TGssdfaQW1L2ZeMEsX62CfP0Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e1HHq-00016T-Qr; Sun, 08 Oct 2017 19:30:54 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e1HHn-000134-JK for ath10k@lists.infradead.org; Sun, 08 Oct 2017 19:30:53 +0000 Received: by mail-wm0-x244.google.com with SMTP id b189so18105192wmd.2 for ; Sun, 08 Oct 2017 12:30:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=I/lD2lx99Wm/eTr8eOeaPXeSjKhc7RLu45lqZKmsg3k=; b=hLCICMMcE0NAbmldHlkPi60RfRDjTtL5vEikkG3gr5b7YaDkBCIqgISKrXJH2MmBwt Whu7BzhYlmSW0tcNMmD8qTFEtVxh5+LIC39MW2XDIW1Nrjmo8WvAottETUe5VN/ygG7W ufoN/Ba87zJBwh8VHLM8gCIhV/pMY70rU4ign6gGN+/2tMi8MfO5LjYbpyoS8VPp055H qTnyFpLw0pj04XtmZaEWt7coTGCREqffBNe98nKvB63W6BDKHK7ZmDefI1NfUeWXOpxa jtI0MSESSKu6JbuNuLfbMh8aKbGrOfs6yXpUZkip0LodV+ci/rTI6TzSy/2Dc3mgUbLw s+VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=I/lD2lx99Wm/eTr8eOeaPXeSjKhc7RLu45lqZKmsg3k=; b=S1PRIY/pesZ+5xHtBYJ8Ybjx43RYQ01UWUnTNrGsXntip7eovyNwf045CjvEBBOYTO JCIOM6O1EsXfbQPxtE0DQX+qcAMj1GcHEqrzx+g314beCAOo9HAaNZ5gnttp4vOl7QlZ OmnxpfuZmGlckGW7VFfbwnOwI0sYxFd3gBDH+9pAq8K+8upa6ww6hplbeHr1dCFi44bB bC6NEth98uD9YvFabT1MjpJWZ9kll5QGy11ubf5te+oWjtVcnsaaaL+Y7Z+SA2yZLcCi fkrLIMIsysC0Zl0pPkehlLgolyeKsSawAgKDxwsfqZQabjlhqPGwyAl6r9IzYt0egI1E 0Hyg== X-Gm-Message-State: AMCzsaWJK/gPHgTnzoljfVxYz3aw12080Bztl4WLdhj4tdGAPRm83kXd jjFsK60rFQuXY8uh6/3qMKx20S52jFE= X-Google-Smtp-Source: AOwi7QB+BiR3B86v9jRCusqF/twhs3WUcnUKKgKlKmuqhIz8FlSQT5WdQF0oeOGHPnCcq0HxEH9XQw== X-Received: by 10.80.144.105 with SMTP id z38mr9526586edz.185.1507491029536; Sun, 08 Oct 2017 12:30:29 -0700 (PDT) Received: from inspiron ([2a02:c7d:5e0c:c300:61ec:ecf7:55fa:ca9a]) by smtp.gmail.com with ESMTPSA id i16sm5292926edj.77.2017.10.08.12.30.28 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 08 Oct 2017 12:30:28 -0700 (PDT) From: Christos Gkekas To: Kalle Valo , ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ath10k: spectral: Simplify error checking Date: Sun, 8 Oct 2017 20:30:26 +0100 Message-Id: <1507491026-28690-1-git-send-email-chris.gekas@gmail.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171008_123051_799423_188523A4 X-CRM114-Status: UNSURE ( 7.90 ) X-CRM114-Notice: Please train this message. X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Christos Gkekas MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Variable val is unsigned so checking whether it is less than zero is redundant. Signed-off-by: Christos Gkekas --- drivers/net/wireless/ath/ath10k/spectral.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/spectral.c b/drivers/net/wireless/ath/ath10k/spectral.c index dd9cc09..1867937 100644 --- a/drivers/net/wireless/ath/ath10k/spectral.c +++ b/drivers/net/wireless/ath/ath10k/spectral.c @@ -403,10 +403,7 @@ static ssize_t write_file_spectral_count(struct file *file, return -EFAULT; buf[len] = '\0'; - if (kstrtoul(buf, 0, &val)) - return -EINVAL; - - if (val < 0 || val > 255) + if (kstrtoul(buf, 0, &val) || val > 255) return -EINVAL; mutex_lock(&ar->conf_mutex);