[PATCH next] drm/xe/vf: Fix IS_ERR() vs NULL check in xe_sriov_vf_ccs_init()

Dan Carpenter posted 1 patch 2 months ago
drivers/gpu/drm/xe/xe_sriov_vf_ccs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH next] drm/xe/vf: Fix IS_ERR() vs NULL check in xe_sriov_vf_ccs_init()
Posted by Dan Carpenter 2 months ago
The xe_migrate_alloc() function returns NULL on error.  It doesn't return
error pointers.  Update the checking to match.

Fixes: a843b9894705 ("drm/xe/vf: Fix VM crash during VF driver release")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/gpu/drm/xe/xe_sriov_vf_ccs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_sriov_vf_ccs.c b/drivers/gpu/drm/xe/xe_sriov_vf_ccs.c
index bf9fa1238462..e363240a3455 100644
--- a/drivers/gpu/drm/xe/xe_sriov_vf_ccs.c
+++ b/drivers/gpu/drm/xe/xe_sriov_vf_ccs.c
@@ -271,8 +271,8 @@ int xe_sriov_vf_ccs_init(struct xe_device *xe)
 		ctx->ctx_id = ctx_id;
 
 		migrate = xe_migrate_alloc(tile);
-		if (IS_ERR(migrate)) {
-			err = PTR_ERR(migrate);
+		if (!migrate) {
+			err = -ENOMEM;
 			goto err_ret;
 		}
 
-- 
2.47.2
Re: [PATCH next] drm/xe/vf: Fix IS_ERR() vs NULL check in xe_sriov_vf_ccs_init()
Posted by Michal Wajdeczko 2 months ago

On 8/1/2025 3:32 PM, Dan Carpenter wrote:
> The xe_migrate_alloc() function returns NULL on error.  It doesn't return
> error pointers.  Update the checking to match.
> 
> Fixes: a843b9894705 ("drm/xe/vf: Fix VM crash during VF driver release")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>

> ---
>  drivers/gpu/drm/xe/xe_sriov_vf_ccs.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_sriov_vf_ccs.c b/drivers/gpu/drm/xe/xe_sriov_vf_ccs.c
> index bf9fa1238462..e363240a3455 100644
> --- a/drivers/gpu/drm/xe/xe_sriov_vf_ccs.c
> +++ b/drivers/gpu/drm/xe/xe_sriov_vf_ccs.c
> @@ -271,8 +271,8 @@ int xe_sriov_vf_ccs_init(struct xe_device *xe)
>  		ctx->ctx_id = ctx_id;
>  
>  		migrate = xe_migrate_alloc(tile);
> -		if (IS_ERR(migrate)) {
> -			err = PTR_ERR(migrate);
> +		if (!migrate) {
> +			err = -ENOMEM;
>  			goto err_ret;
>  		}
>