From: Jeevan B <jeevan.b@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: karthik.b.s@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: Mon, 22 Sep 2025 10:12:48 +0530 [thread overview]
Message-ID: <20250922044249.1374338-2-jeevan.b@intel.com> (raw)
In-Reply-To: <20250922044249.1374338-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.
v2: write to *mode_ret before returning from function.
Signed-off-by: Jeevan B <jeevan.b@intel.com>
Reviewed-by: Karthik B S <karthik.b.s@intel.com>
---
tests/kms_setmode.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c
index 484c3a95f..48d0c3e1e 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,10 +262,11 @@ 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;
}
--
2.43.0
next prev parent reply other threads:[~2025-09-22 4:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Jeevan B [this message]
2025-09-22 4:42 ` [PATCH i-g-t 2/2] " Jeevan B
2025-09-26 4:32 ` Karthik B S
2025-09-22 5:35 ` ✓ Xe.CI.BAT: success for tests/kms_setmode: Fix clone mode mismatch by preferring eDP mode (rev7) Patchwork
2025-09-22 5:43 ` ✓ i915.CI.BAT: " Patchwork
2025-09-22 7:12 ` ✗ Xe.CI.Full: failure " Patchwork
2025-09-22 7:57 ` ✗ i915.CI.Full: " Patchwork
-- strict thread matches above, loose matches on Subject: below --
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-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-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 ` [PATCH i-g-t 1/2] tests/kms_setmode: simplify mode selection by removing goto Jeevan B
2025-09-18 15:37 ` Kamil Konieczny
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=20250922044249.1374338-2-jeevan.b@intel.com \
--to=jeevan.b@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=karthik.b.s@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.