diff mbox series

[v2] drm/i915/selftests: fix a couple IS_ERR() vs NULL tests

Message ID 20220708094104.GL2316@kadam (mailing list archive)
State New, archived
Headers show
Series [v2] drm/i915/selftests: fix a couple IS_ERR() vs NULL tests | expand

Commit Message

Dan Carpenter July 8, 2022, 9:41 a.m. UTC
The shmem_pin_map() function doesn't return error pointers, it returns
NULL.

Fixes: be1cb55a07bf ("drm/i915/gt: Keep a no-frills swappable copy of the default context state")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
---
v2: Correct the Fixes tag.  Add Matthew's reviewed-by tag.

 drivers/gpu/drm/i915/gt/selftest_lrc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Matthew Auld July 11, 2022, 9:28 a.m. UTC | #1
On 08/07/2022 10:41, Dan Carpenter wrote:
> The shmem_pin_map() function doesn't return error pointers, it returns
> NULL.
> 
> Fixes: be1cb55a07bf ("drm/i915/gt: Keep a no-frills swappable copy of the default context state")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Reviewed-by: Matthew Auld <matthew.auld@intel.com>

Pushed to drm-intel-gt-next. Thanks for the fix.

> ---
> v2: Correct the Fixes tag.  Add Matthew's reviewed-by tag.
> 
>   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);
diff mbox series

Patch

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);