[Intel-gfx] [PATCH] drm/i915/selftests: fix a couple IS_ERR() vs NULL tests

Subsystems: drm drivers, intel drm i915 driver (meteor lake, dg2 and older excluding poulsbo, moorestown and derivative), the rest

3 messages, 2 authors, 2022-07-08 · open the first message on its own page

[Intel-gfx] [PATCH] drm/i915/selftests: fix a couple IS_ERR() vs NULL tests

From: Dan Carpenter <hidden>
Date: 2022-07-08 08:41:26

The shmem_pin_map() function doesn't return error pointers, it returns
NULL.

Fixes: a0d3fdb628b8 ("drm/i915/gt: Split logical ring contexts from execlist submission"
Signed-off-by: Dan Carpenter <redacted>
---
 drivers/gpu/drm/i915/gt/selftest_lrc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/i915/gt/selftest_lrc.c b/drivers/gpu/drm/i915/gt/selftest_lrc.c
index 8b2c11dbe354..1109088fe8f6 100644
--- a/drivers/gpu/drm/i915/gt/selftest_lrc.c
+++ b/drivers/gpu/drm/i915/gt/selftest_lrc.c
@@ -176,8 +176,8 @@ static int live_lrc_layout(void *arg)
 			continue;
 
 		hw = shmem_pin_map(engine->default_state);
-		if (IS_ERR(hw)) {
-			err = PTR_ERR(hw);
+		if (!hw) {
+			err = -ENOMEM;
 			break;
 		}
 		hw += LRC_STATE_OFFSET / sizeof(*hw);
@@ -365,8 +365,8 @@ static int live_lrc_fixed(void *arg)
 			continue;
 
 		hw = shmem_pin_map(engine->default_state);
-		if (IS_ERR(hw)) {
-			err = PTR_ERR(hw);
+		if (!hw) {
+			err = -ENOMEM;
 			break;
 		}
 		hw += LRC_STATE_OFFSET / sizeof(*hw);
-- 
2.35.1

Re: [Intel-gfx] [PATCH] drm/i915/selftests: fix a couple IS_ERR() vs NULL tests

From: Matthew Auld <matthew.auld@intel.com>
Date: 2022-07-08 09:02:43

On 08/07/2022 09:40, Dan Carpenter wrote:
The shmem_pin_map() function doesn't return error pointers, it returns
NULL.

Fixes: a0d3fdb628b8 ("drm/i915/gt: Split logical ring contexts from execlist submission"
I think this should be:

Fixes: be1cb55a07bf ("drm/i915/gt: Keep a no-frills swappable copy of the default context state")
Signed-off-by: Dan Carpenter <redacted>
There looks to be one more in gvt/cmd_parser.c?

Otherwise,
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
quoted hunk
---
  drivers/gpu/drm/i915/gt/selftest_lrc.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/i915/gt/selftest_lrc.c b/drivers/gpu/drm/i915/gt/selftest_lrc.c
index 8b2c11dbe354..1109088fe8f6 100644
--- a/drivers/gpu/drm/i915/gt/selftest_lrc.c
+++ b/drivers/gpu/drm/i915/gt/selftest_lrc.c
@@ -176,8 +176,8 @@ static int live_lrc_layout(void *arg)
  			continue;
  
  		hw = shmem_pin_map(engine->default_state);
-		if (IS_ERR(hw)) {
-			err = PTR_ERR(hw);
+		if (!hw) {
+			err = -ENOMEM;
  			break;
  		}
  		hw += LRC_STATE_OFFSET / sizeof(*hw);
@@ -365,8 +365,8 @@ static int live_lrc_fixed(void *arg)
  			continue;
  
  		hw = shmem_pin_map(engine->default_state);
-		if (IS_ERR(hw)) {
-			err = PTR_ERR(hw);
+		if (!hw) {
+			err = -ENOMEM;
  			break;
  		}
  		hw += LRC_STATE_OFFSET / sizeof(*hw);

Re: [Intel-gfx] [PATCH] drm/i915/selftests: fix a couple IS_ERR() vs NULL tests

From: Dan Carpenter <hidden>
Date: 2022-07-08 09:28:30

On Fri, Jul 08, 2022 at 10:02:34AM +0100, Matthew Auld wrote:
On 08/07/2022 09:40, Dan Carpenter wrote:
quoted
The shmem_pin_map() function doesn't return error pointers, it returns
NULL.

Fixes: a0d3fdb628b8 ("drm/i915/gt: Split logical ring contexts from execlist submission"
I think this should be:

Fixes: be1cb55a07bf ("drm/i915/gt: Keep a no-frills swappable copy of the
default context state")
Ah, right.  I will resend.
quoted
Signed-off-by: Dan Carpenter <redacted>
There looks to be one more in gvt/cmd_parser.c?
I fixed that one in a separate patch?

regards,
dan carpenter
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help