LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] drm/i915/selftest: Fix use of err in igt_reset_{fail,nop}_engine()
@ 2021-08-13 17:11 Nathan Chancellor
  2021-08-23 19:08 ` [Intel-gfx] [PATCH] drm/i915/selftest: Fix use of err in igt_reset_{fail, nop}_engine() Nathan Chancellor
  0 siblings, 1 reply; 3+ messages in thread
From: Nathan Chancellor @ 2021-08-13 17:11 UTC (permalink / raw)
  To: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi
  Cc: John Harrison, Matthew Brost, intel-gfx, dri-devel, linux-kernel,
	clang-built-linux, kernel-janitors, Nathan Chancellor,
	Dan Carpenter

Clang warns:

In file included from drivers/gpu/drm/i915/gt/intel_reset.c:1514:
drivers/gpu/drm/i915/gt/selftest_hangcheck.c:465:62: warning: variable
'err' is uninitialized when used here [-Wuninitialized]
        pr_err("[%s] Create context failed: %d!\n", engine->name, err);
                                                                  ^~~
...
drivers/gpu/drm/i915/gt/selftest_hangcheck.c:580:62: warning: variable
'err' is uninitialized when used here [-Wuninitialized]
        pr_err("[%s] Create context failed: %d!\n", engine->name, err);
                                                                  ^~~
...
2 warnings generated.

This appears to be a copy and paste issue. Use ce directly using the %pe
specifier to pretty print the error code so that err is not used
uninitialized in these functions.

Fixes: 3a7b72665ea5 ("drm/i915/selftest: Bump selftest timeouts for hangcheck")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 drivers/gpu/drm/i915/gt/selftest_hangcheck.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/selftest_hangcheck.c b/drivers/gpu/drm/i915/gt/selftest_hangcheck.c
index 08f011f893b2..2c1ed32ca5ac 100644
--- a/drivers/gpu/drm/i915/gt/selftest_hangcheck.c
+++ b/drivers/gpu/drm/i915/gt/selftest_hangcheck.c
@@ -462,7 +462,7 @@ static int igt_reset_nop_engine(void *arg)
 
 		ce = intel_context_create(engine);
 		if (IS_ERR(ce)) {
-			pr_err("[%s] Create context failed: %d!\n", engine->name, err);
+			pr_err("[%s] Create context failed: %pe!\n", engine->name, ce);
 			return PTR_ERR(ce);
 		}
 
@@ -577,7 +577,7 @@ static int igt_reset_fail_engine(void *arg)
 
 		ce = intel_context_create(engine);
 		if (IS_ERR(ce)) {
-			pr_err("[%s] Create context failed: %d!\n", engine->name, err);
+			pr_err("[%s] Create context failed: %pe!\n", engine->name, ce);
 			return PTR_ERR(ce);
 		}
 

base-commit: 927dfdd09d8c03ba100ed0c8c3915f8e1d1f5556
-- 
2.33.0.rc2


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

end of thread, other threads:[~2021-08-24  9:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-13 17:11 [PATCH] drm/i915/selftest: Fix use of err in igt_reset_{fail,nop}_engine() Nathan Chancellor
2021-08-23 19:08 ` [Intel-gfx] [PATCH] drm/i915/selftest: Fix use of err in igt_reset_{fail, nop}_engine() Nathan Chancellor
2021-08-24  9:52   ` Joonas Lahtinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).