public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/scheduler: Use ternary operator in standardized manner
@ 2024-07-15  7:15 Philipp Stanner
  2024-07-16 16:47 ` Matthew Brost
  2024-07-24  7:34 ` Jani Nikula
  0 siblings, 2 replies; 3+ messages in thread
From: Philipp Stanner @ 2024-07-15  7:15 UTC (permalink / raw)
  To: Luben Tuikov, Matthew Brost, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Daniel Vetter
  Cc: dri-devel, linux-kernel, Philipp Stanner, Marco Pagani

drm_sched_init() omits the middle operand when using the ternary
operator to set the timeout_wq if one has been passed.

This is a non-standardized GNU extension to the C language [1].

It decreases code readability and might be read as a bug. Furthermore,
it is not consistent with all other places in drm/scheduler where the
ternary operator is used.

Replace the expression with the standard one.

[1] https://gcc.gnu.org/onlinedocs/gcc-14.1.0/gcc/Conditionals.html

Suggested-by: Marco Pagani <marpagan@redhat.com>
Signed-off-by: Philipp Stanner <pstanner@redhat.com>
---
 drivers/gpu/drm/scheduler/sched_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
index 7e90c9f95611..02cf9c37a232 100644
--- a/drivers/gpu/drm/scheduler/sched_main.c
+++ b/drivers/gpu/drm/scheduler/sched_main.c
@@ -1257,7 +1257,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched,
 	sched->credit_limit = credit_limit;
 	sched->name = name;
 	sched->timeout = timeout;
-	sched->timeout_wq = timeout_wq ? : system_wq;
+	sched->timeout_wq = timeout_wq ? timeout_wq : system_wq;
 	sched->hang_limit = hang_limit;
 	sched->score = score ? score : &sched->_score;
 	sched->dev = dev;
-- 
2.45.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-07-24  7:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-15  7:15 [PATCH] drm/scheduler: Use ternary operator in standardized manner Philipp Stanner
2024-07-16 16:47 ` Matthew Brost
2024-07-24  7:34 ` Jani Nikula

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox