diff mbox series

[v9,4/9] drm/i915/gt: Pass the -EINVAL when emit_pte doesn't update any PTE

Message ID 20220405150840.29351-5-ramalingam.c@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/ttm: Evict and restore of compressed object | expand

Commit Message

Ramalingam C April 5, 2022, 3:08 p.m. UTC
When emit_pte doesn't update any PTE with return value as 0, interpret
it as -EINVAL.

v2:
  Add missing goto [Thomas]

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/gt/intel_migrate.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Thomas Hellström (Intel) April 8, 2022, 9:02 a.m. UTC | #1
On 4/5/22 17:08, Ramalingam C wrote:
> When emit_pte doesn't update any PTE with return value as 0, interpret
> it as -EINVAL.
>
> v2:
>    Add missing goto [Thomas]
>
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> ---
>   drivers/gpu/drm/i915/gt/intel_migrate.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_migrate.c b/drivers/gpu/drm/i915/gt/intel_migrate.c
> index e0f1c727662e..6378d4450e1a 100644
> --- a/drivers/gpu/drm/i915/gt/intel_migrate.c
> +++ b/drivers/gpu/drm/i915/gt/intel_migrate.c
> @@ -577,7 +577,11 @@ intel_context_migrate_copy(struct intel_context *ce,
>   
>   		len = emit_pte(rq, &it_src, src_cache_level, src_is_lmem,
>   			       src_offset, CHUNK_SZ);

     if (len <= 0) {

         err = len ? len : -EINVAL;

         goto out_rq;

} ?

Up to you.

Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>



> -		if (len <= 0) {
> +		if (!len) {
> +			err = -EINVAL;
> +			goto out_rq;
> +		}
> +		if (len < 0) {
>   			err = len;
>   			goto out_rq;
>   		}
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/intel_migrate.c b/drivers/gpu/drm/i915/gt/intel_migrate.c
index e0f1c727662e..6378d4450e1a 100644
--- a/drivers/gpu/drm/i915/gt/intel_migrate.c
+++ b/drivers/gpu/drm/i915/gt/intel_migrate.c
@@ -577,7 +577,11 @@  intel_context_migrate_copy(struct intel_context *ce,
 
 		len = emit_pte(rq, &it_src, src_cache_level, src_is_lmem,
 			       src_offset, CHUNK_SZ);
-		if (len <= 0) {
+		if (!len) {
+			err = -EINVAL;
+			goto out_rq;
+		}
+		if (len < 0) {
 			err = len;
 			goto out_rq;
 		}