linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Shishkin <alexander.shishkin@linux.intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, Pavel Machek <pavel@ucw.cz>,
	Pavel Machek <pavel@denx.de>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH 5/7] intel_th: Consistency and off-by-one fix
Date: Wed, 14 Apr 2021 20:12:49 +0300	[thread overview]
Message-ID: <20210414171251.14672-6-alexander.shishkin@linux.intel.com> (raw)
In-Reply-To: <20210414171251.14672-1-alexander.shishkin@linux.intel.com>

From: Pavel Machek <pavel@ucw.cz>

Consistently use "< ... +1" in for loops.

Fix of-by-one in for_each_set_bit().

Signed-off-by: Pavel Machek <pavel@denx.de>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Link: https://lore.kernel.org/lkml/20190724095841.GA6952@amd/
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/hwtracing/intel_th/gth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hwtracing/intel_th/gth.c b/drivers/hwtracing/intel_th/gth.c
index f72803a02391..28509b02a0b5 100644
--- a/drivers/hwtracing/intel_th/gth.c
+++ b/drivers/hwtracing/intel_th/gth.c
@@ -543,7 +543,7 @@ static void intel_th_gth_disable(struct intel_th_device *thdev,
 	output->active = false;
 
 	for_each_set_bit(master, gth->output[output->port].master,
-			 TH_CONFIGURABLE_MASTERS) {
+			 TH_CONFIGURABLE_MASTERS + 1) {
 		gth_master_set(gth, master, -1);
 	}
 	spin_unlock(&gth->gth_lock);
@@ -697,7 +697,7 @@ static void intel_th_gth_unassign(struct intel_th_device *thdev,
 	othdev->output.port = -1;
 	othdev->output.active = false;
 	gth->output[port].output = NULL;
-	for (master = 0; master <= TH_CONFIGURABLE_MASTERS; master++)
+	for (master = 0; master < TH_CONFIGURABLE_MASTERS + 1; master++)
 		if (gth->master[master] == port)
 			gth->master[master] = -1;
 	spin_unlock(&gth->gth_lock);
-- 
2.30.2


  parent reply	other threads:[~2021-04-14 17:12 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-14 17:12 [PATCH 0/7] stm class/intel_th: Updates for v5.13 Alexander Shishkin
2021-04-14 17:12 ` [PATCH 1/7] stm class: Remove an unused function Alexander Shishkin
2021-04-14 17:12 ` [PATCH 2/7] stm class: Replace uuid_t with plain u8 uuid[16] Alexander Shishkin
2021-04-14 17:33   ` Greg Kroah-Hartman
2021-04-14 17:47     ` Andy Shevchenko
2021-04-14 18:56       ` Greg Kroah-Hartman
2021-04-14 19:12         ` Andy Shevchenko
2021-04-14 19:14         ` Alexander Shishkin
2021-04-14 19:16           ` Andy Shevchenko
2021-04-15  8:34           ` Greg Kroah-Hartman
2021-04-15  8:48             ` Andy Shevchenko
2021-04-15  9:08               ` Greg Kroah-Hartman
2021-04-15  9:20             ` Alexander Shishkin
2021-04-14 17:12 ` [PATCH 3/7] intel_th: Constify all drvdata references Alexander Shishkin
2021-04-14 17:12 ` [PATCH 4/7] intel_th: Constify attribute_group structs Alexander Shishkin
2021-04-14 17:12 ` Alexander Shishkin [this message]
2021-04-14 17:12 ` [PATCH 6/7] intel_th: pci: Add Rocket Lake CPU support Alexander Shishkin
2021-04-14 17:12 ` [PATCH 7/7] intel_th: pci: Add Alder Lake-M support Alexander Shishkin

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=20210414171251.14672-6-alexander.shishkin@linux.intel.com \
    --to=alexander.shishkin@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@denx.de \
    --cc=pavel@ucw.cz \
    /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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).