From: Jeevan B <jeevan.b@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: swati2.sharma@intel.com, Jeevan B <jeevan.b@intel.com>
Subject: [PATCH i-g-t 1/2] tests/kms_setmode: simplify mode selection by removing goto
Date: Wed, 17 Sep 2025 20:13:07 +0530 [thread overview]
Message-ID: <20250917144308.1355953-2-jeevan.b@intel.com> (raw)
In-Reply-To: <20250917144308.1355953-1-jeevan.b@intel.com>
replaced 'goto found' with early returns in get_mode_for_crtc() and
added braces around the fallback loop. This makes the logic cleaner
and easier to follow without changing behavior.
Signed-off-by: Jeevan B <jeevan.b@intel.com>
---
tests/kms_setmode.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c
index 484c3a95f..49fc45043 100644
--- a/tests/kms_setmode.c
+++ b/tests/kms_setmode.c
@@ -238,8 +238,10 @@ static void get_mode_for_crtc(struct crtc_config *crtc,
*/
for (i = 0; i < crtc->connector_count; i++) {
mode = &crtc->cconfs[i].default_mode;
- if (crtc_supports_mode(crtc, mode))
- goto found;
+ if (crtc_supports_mode(crtc, mode)) {
+ *mode_ret = *mode;
+ return;
+ }
}
/*
@@ -248,8 +250,10 @@ static void get_mode_for_crtc(struct crtc_config *crtc,
*/
for (i = 0; i < crtc->cconfs[0].connector->count_modes; i++) {
mode = &crtc->cconfs[0].connector->modes[i];
- if (crtc_supports_mode(crtc, mode))
- goto found;
+ if (crtc_supports_mode(crtc, mode)) {
+ *mode_ret = *mode;
+ return;
+ }
}
/*
@@ -258,11 +262,10 @@ static void get_mode_for_crtc(struct crtc_config *crtc,
* scaling etc.
*/
mode = &crtc->cconfs[0].default_mode;
- for (i = 1; i < crtc->connector_count; i++)
+ for (i = 1; i < crtc->connector_count; i++) {
if (crtc->cconfs[i].default_mode.clock < mode->clock)
mode = &crtc->cconfs[i].default_mode;
-found:
- *mode_ret = *mode;
+ }
}
static int get_encoder_idx(drmModeRes *resources, drmModeEncoder *encoder)
--
2.43.0
next prev parent reply other threads:[~2025-09-17 14:43 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-17 14:43 [PATCH i-g-t 0/2] tests/kms_setmode: Fix clone mode mismatch by preferring eDP mode Jeevan B
2025-09-17 14:43 ` Jeevan B [this message]
2025-09-18 15:37 ` [PATCH i-g-t 1/2] tests/kms_setmode: simplify mode selection by removing goto Kamil Konieczny
2025-09-17 14:43 ` [PATCH i-g-t 2/2] tests/kms_setmode: Fix clone mode mismatch by preferring eDP mode Jeevan B
2025-09-18 15:41 ` Kamil Konieczny
2025-09-18 15:51 ` B, Jeevan
2025-09-18 4:28 ` ✓ Xe.CI.BAT: success for tests/kms_setmode: Fix clone mode mismatch by preferring eDP mode (rev4) Patchwork
2025-09-18 4:41 ` ✓ i915.CI.BAT: " Patchwork
2025-09-18 10:38 ` ✗ Xe.CI.Full: failure " Patchwork
2025-09-18 11:53 ` ✗ i915.CI.Full: " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2025-09-19 3:17 [PATCH i-g-t 0/2] tests/kms_setmode: Fix clone mode mismatch by preferring eDP mode Jeevan B
2025-09-19 3:17 ` [PATCH i-g-t 1/2] tests/kms_setmode: simplify mode selection by removing goto Jeevan B
2025-09-19 5:34 ` Karthik B S
2025-09-22 4:01 [PATCH i-g-t 0/2] tests/kms_setmode: Fix clone mode mismatch by preferring eDP mode Jeevan B
2025-09-22 4:01 ` [PATCH i-g-t 1/2] tests/kms_setmode: simplify mode selection by removing goto Jeevan B
2025-09-22 4:42 [PATCH i-g-t 0/2] tests/kms_setmode: Fix clone mode mismatch by preferring eDP mode Jeevan B
2025-09-22 4:42 ` [PATCH i-g-t 1/2] tests/kms_setmode: simplify mode selection by removing goto Jeevan B
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=20250917144308.1355953-2-jeevan.b@intel.com \
--to=jeevan.b@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=swati2.sharma@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 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.