[PATCH 09/10] drm/panthor: move size check to mmu_hw_flush_caches

Chia-I Wu posted 10 patches 2 weeks, 1 day ago
[PATCH 09/10] drm/panthor: move size check to mmu_hw_flush_caches
Posted by Chia-I Wu 2 weeks, 1 day ago
We can early return from mmu_hw_flush_caches when size is 0.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
---
 drivers/gpu/drm/panthor/panthor_mmu.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c
index 436a54e30a36d..743e9342eece7 100644
--- a/drivers/gpu/drm/panthor/panthor_mmu.c
+++ b/drivers/gpu/drm/panthor/panthor_mmu.c
@@ -570,9 +570,6 @@ static void mmu_hw_cmd_lock(struct panthor_device *ptdev, u32 as_nr, u64 region_
 	u64 region;
 	u64 region_end = region_start + size;
 
-	if (!size)
-		return;
-
 	/*
 	 * The locked region is a naturally aligned power of 2 block encoded as
 	 * log2 minus(1).
@@ -643,7 +640,7 @@ static int mmu_hw_flush_caches(struct panthor_device *ptdev, int as_nr, u64 iova
 		return -EINVAL;
 	}
 
-	if (as_nr < 0)
+	if (as_nr < 0 || !size)
 		return 0;
 
 	/*
-- 
2.51.0.384.g4c02a37b29-goog