From patchwork Mon Sep 14 19:19:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Dewar X-Patchwork-Id: 11774749 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F29676CA for ; Mon, 14 Sep 2020 19:20:17 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BB93E208E4 for ; Mon, 14 Sep 2020 19:20:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="vLN4rkoG"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JddnqwPR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BB93E208E4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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=42ZrrXBerh6cZxoJmIEprR+44zbrJPBGYj5rc5xKp+s=; b=vLN4rkoGG5VUHKIC5Oh46iktqQ 5qk91lrACBZUEm+/u1x1vyZmIi6KoMh3aUuP5kW9CzMvs2LTYDdjiiDuWbjULaW49ikD/fndhLM2T WEPFx+NRvKhy4Lnllb9ytoVMvvCUyjVSiZsbIyA1LM77zHsjOL9dWrCdvoxnpwBiO5dAaz6jcGa3M yygS+7LL2elxmf3bQRnNlt21nuq5jg8z51GCuzD7KQgr1w1JT4RcbyBI3sdkzI1+a4K9kMu1dtuI0 Xgc17ZDtpJ0r2/Vq1h2jz3ibnXOIKzyca+1S/LWhTWPp090WiVEQgEWe+LO+zQnU4zMdQq2u007P5 eJPDEG2g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kHu0n-0000dd-T3; Mon, 14 Sep 2020 19:19:37 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kHu0i-0000cx-Ki for ath10k@lists.infradead.org; Mon, 14 Sep 2020 19:19:36 +0000 Received: by mail-wr1-x441.google.com with SMTP id c18so788989wrm.9 for ; Mon, 14 Sep 2020 12:19: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:mime-version :content-transfer-encoding; bh=qKGbni03/+MWZC7/hBbqoYRev2UK6B57mdiozLjRsiw=; b=JddnqwPRNNm9iAwoqKQZhgHV8tcQlhLzE02xSECcpQH5QPON1+zWAWI9Z3pfkt1XeQ YDdJ1Del1AQiqE73MLIMDwUiRe57kW/BDvSai11W6pGcboPKx5srCq5ToMCIKw7k+gqw 48hoCO9h7PYCj4iFyvWBiGrtnNKcrj7udO4R7uXH7raueaW+BpveF0YdPxsi7QcFjX12 4Ydct7OA1u5dRqE86Xh/pyTPsYWVJkWGiA+8xJN70phctgb05VT+TJI4p1v8bRv7FlHU F0o3EjEWUSZdC1TcSNfcgFLN798xjQ7GmmO+vdtU++p/h0yCTlQbjm25MD6fJLZkKxl4 zjPg== 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:mime-version :content-transfer-encoding; bh=qKGbni03/+MWZC7/hBbqoYRev2UK6B57mdiozLjRsiw=; b=tzr80AVW3cFh0jgXIffXsf2R2Xl07568aMPgNridfWtbHa68G+QvvWkidp6nahBVEb Uh5NCCuKOX1QaRxvCbiq3fat0muvTKaAHaLf8DXkak0nXxeBox41aDahIuyZqF3q9gA0 qvO/Cy3Aao1GQ5DbZbiRKNMdnTi6iBnJl9vNeSbkS3GMooLKc4n78wGjt0L+SIo0sxMP dT0KnBGw6fs7xTutECbwFdn7sOq1SC5BO8ScTw/SF94UZRK+KgAM0yNUf/K5T6NveS7P Y58E0qKeZcWLU6FW/KPdVJcQL6Rjs04H4zjvgv1WNELK1KccGTmawC6OWTTt40tyoD/8 NuCA== X-Gm-Message-State: AOAM530QudCVVsYIQwqaPYp+ArSsx6TRpVqoiyTTu9d7oXEYGYOKXAiK 3tU1mtYR9rpysm3F1Lo7e+E= X-Google-Smtp-Source: ABdhPJxUBzpUmmWU1XYCCWUW3ZryO7slOwvnjI69CGQm6+CraXFBeI+iKS4Gc4+bvmyKI/z1D2DDlw== X-Received: by 2002:a5d:4c4c:: with SMTP id n12mr4266876wrt.162.1600111169912; Mon, 14 Sep 2020 12:19:29 -0700 (PDT) Received: from localhost.localdomain (cpc83661-brig20-2-0-cust443.3-3.cable.virginm.net. [82.28.105.188]) by smtp.gmail.com with ESMTPSA id n21sm20891266wmi.21.2020.09.14.12.19.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Sep 2020 12:19:29 -0700 (PDT) From: Alex Dewar To: Subject: [PATCH] ath10k: sdio: remove reduntant check in for loop Date: Mon, 14 Sep 2020 20:19:24 +0100 Message-Id: <20200914191925.24192-1-alex.dewar90@gmail.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200914_151932_718846_EA16DEBF X-CRM114-Status: GOOD ( 15.27 ) X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:441 listed in] [list.dnswl.org] 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit [alex.dewar90[at]gmail.com] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [alex.dewar90[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, ath10k@lists.infradead.org, "David S. Miller" , Jakub Kicinski , Alex Dewar , Kalle Valo Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org The for loop checks whether cur_section is NULL on every iteration, but we know it can never be NULL as there is another check towards the bottom of the loop body. Remove this unnecessary check. Also change i to start at 1, so that we don't need an extra +1 when we use it. Addresses-Coverity: 1496984 ("Null pointer dereferences) Signed-off-by: Alex Dewar --- drivers/net/wireless/ath/ath10k/sdio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c index 81ddaafb6721..f31ab2ec2c48 100644 --- a/drivers/net/wireless/ath/ath10k/sdio.c +++ b/drivers/net/wireless/ath/ath10k/sdio.c @@ -2308,7 +2308,7 @@ static int ath10k_sdio_dump_memory_section(struct ath10k *ar, count = 0; - for (i = 0; cur_section; i++) { + for (i = 1; ; i++) { section_size = cur_section->end - cur_section->start; if (section_size <= 0) { @@ -2318,7 +2318,7 @@ static int ath10k_sdio_dump_memory_section(struct ath10k *ar, break; } - if ((i + 1) == mem_region->section_table.size) { + if (i == mem_region->section_table.size) { /* last section */ next_section = NULL; skip_size = 0;