[Intel-gfx] [PATCH] drm/i915/gt: Remove assignment from if condition

Gilbert Adikankwu gilbertadikankwu at gmail.com
Thu Oct 26 13:58:39 UTC 2023


Initialize variable "entry" during declaration. Remove assignment from if
condition.

Fix checkpatch.pl error:
ERROR: do not use assignment in if condition

Signed-off-by: Gilbert Adikankwu <gilbertadikankwu at gmail.com>
---
 drivers/gpu/drm/i915/gt/intel_execlists_submission.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_execlists_submission.c b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
index e8f42ec6b1b4..cbc4ecf26d8b 100644
--- a/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
+++ b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c
@@ -1751,7 +1751,7 @@ static bool gen8_csb_parse(const u64 csb)
 static noinline u64
 wa_csb_read(const struct intel_engine_cs *engine, u64 * const csb)
 {
-	u64 entry;
+	u64 entry = READ_ONCE(*csb);
 
 	/*
 	 * Reading from the HWSP has one particular advantage: we can detect
@@ -1763,7 +1763,7 @@ wa_csb_read(const struct intel_engine_cs *engine, u64 * const csb)
 	 * tgl,dg1:HSDES#22011327657
 	 */
 	preempt_disable();
-	if (wait_for_atomic_us((entry = READ_ONCE(*csb)) != -1, 10)) {
+	if (wait_for_atomic_us(entry != -1, 10)) {
 		int idx = csb - engine->execlists.csb_status;
 		int status;
 
-- 
2.34.1



More information about the Intel-gfx mailing list