Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Kunal Joshi <kunal1.joshi@intel.com>
Subject: [PATCH i-g-t 2/3] lib/kms: Simplify force_connectors[] error handling
Date: Wed, 10 Apr 2024 18:02:28 +0300	[thread overview]
Message-ID: <20240410150229.28922-2-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20240410150229.28922-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

The failure to allocate a forced_connector entry is entirely
our own fault. If we hit this then we've screwd up and made
the array too small. Skip the error handling and just assert
that we must have enough room in the array.

Cc: Kunal Joshi <kunal1.joshi@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_kms.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index f7dd1db91827..19bb4ac66ece 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1518,8 +1518,7 @@ static struct igt_forced_connector *forced_connector_alloc(void)
 	for (i = 0; forced_connectors[i].connector_type; i++)
 		;
 
-	if (i >= ARRAY_SIZE(forced_connectors))
-		return NULL;
+	igt_assert_lt(i, ARRAY_SIZE(forced_connectors));
 
 	return &forced_connectors[i];
 }
@@ -1558,11 +1557,6 @@ static bool force_connector(int drm_fd,
 	}
 
 	c = forced_connector_alloc();
-	if (!c) {
-		igt_warn("Connector limit reached, %s will not be reset\n", name);
-		close(dir);
-		return true;
-	}
 
 	c->idx = idx;
 	c->connector_type = connector->connector_type;
-- 
2.43.2


  reply	other threads:[~2024-04-10 15:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-10 15:02 [PATCH i-g-t 1/3] lib/kms: Introduce struct igt_forced_connector Ville Syrjala
2024-04-10 15:02 ` Ville Syrjala [this message]
2024-04-11  6:15   ` [i-g-t,2/3] lib/kms: Simplify force_connectors[] error handling Joshi, Kunal1
2024-04-11  8:25   ` [PATCH i-g-t 2/3] " Kamil Konieczny
2024-04-11 13:23     ` Ville Syrjälä
2024-04-10 15:02 ` [PATCH i-g-t 3/3] lib/kms: Generalize forced_connectors[] to handle arbitrary attributes Ville Syrjala
2024-04-11  7:47   ` [i-g-t,3/3] " Joshi, Kunal1
2024-04-11 14:51     ` Ville Syrjälä
2024-04-10 23:56 ` ✗ CI.xeBAT: failure for series starting with [i-g-t,1/3] lib/kms: Introduce struct igt_forced_connector Patchwork
2024-04-11  0:17 ` ✗ Fi.CI.BAT: " Patchwork
2024-04-11  6:14 ` Joshi, Kunal1

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=20240410150229.28922-2-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kunal1.joshi@intel.com \
    /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