From: Alex Dewar <alex.dewar90@gmail.com> To: unlisted-recipients:; (no To-header on input) Cc: Alex Dewar <alex.dewar90@gmail.com>, Kalle Valo <kvalo@codeaurora.org>, "David S. Miller" <davem@davemloft.net>, Jakub Kicinski <kuba@kernel.org>, ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ath10k: sdio: remove reduntant check in for loop Date: Mon, 14 Sep 2020 20:19:24 +0100 [thread overview] Message-ID: <20200914191925.24192-1-alex.dewar90@gmail.com> (raw) 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 <alex.dewar90@gmail.com> --- 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; -- 2.28.0
WARNING: multiple messages have this Message-ID (diff)
From: Alex Dewar <alex.dewar90@gmail.com> Cc: netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, ath10k@lists.infradead.org, "David S. Miller" <davem@davemloft.net>, Jakub Kicinski <kuba@kernel.org>, Alex Dewar <alex.dewar90@gmail.com>, Kalle Valo <kvalo@codeaurora.org> Subject: [PATCH] ath10k: sdio: remove reduntant check in for loop Date: Mon, 14 Sep 2020 20:19:24 +0100 [thread overview] Message-ID: <20200914191925.24192-1-alex.dewar90@gmail.com> (raw) 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 <alex.dewar90@gmail.com> --- 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; -- 2.28.0 _______________________________________________ ath10k mailing list ath10k@lists.infradead.org http://lists.infradead.org/mailman/listinfo/ath10k
next reply other threads:[~2020-09-14 19:19 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-09-14 19:19 Alex Dewar [this message] 2020-09-14 19:19 ` [PATCH] ath10k: sdio: remove reduntant check in for loop Alex Dewar 2020-09-14 21:51 ` Saeed Mahameed 2020-09-14 21:51 ` Saeed Mahameed 2020-09-16 16:57 ` [PATCH v2] ath10k: sdio: remove redundant " Alex Dewar 2020-09-16 16:57 ` Alex Dewar 2020-09-17 0:45 ` Julian Calaby 2020-09-17 0:45 ` Julian Calaby 2020-09-24 16:27 ` Kalle Valo 2020-09-24 16:27 ` Kalle Valo 2020-09-27 10:58 ` Alex Dewar 2020-09-27 10:58 ` Alex Dewar 2020-09-29 7:42 ` Kalle Valo 2020-09-29 7:42 ` Kalle Valo 2020-11-06 6:36 ` Kalle Valo 2020-11-06 6:36 ` Kalle Valo 2020-09-16 16:59 ` [PATCH] ath10k: sdio: remove reduntant " Alex Dewar 2020-09-16 16:59 ` Alex Dewar
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200914191925.24192-1-alex.dewar90@gmail.com \ --to=alex.dewar90@gmail.com \ --cc=ath10k@lists.infradead.org \ --cc=davem@davemloft.net \ --cc=kuba@kernel.org \ --cc=kvalo@codeaurora.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-wireless@vger.kernel.org \ --cc=netdev@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.