summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/panthor
diff options
context:
space:
mode:
authorHarshit Mogalapalli <harshit.m.mogalapalli@oracle.com>2024-04-02 07:14:11 -0700
committerBoris Brezillon <boris.brezillon@collabora.com>2024-04-03 09:11:38 +0200
commit45c734fdd43db14444025910b4c59dd2b8be714a (patch)
tree8248c6fbeb7d9cd3e91696e31f4be93a0f44be64 /drivers/gpu/drm/panthor
parent6e0718f21feda0ed97f932cee39b676817e457f2 (diff)
downloadlwn-45c734fdd43db14444025910b4c59dd2b8be714a.tar.gz
lwn-45c734fdd43db14444025910b4c59dd2b8be714a.zip
drm/panthor: Don't return NULL from panthor_vm_get_heap_pool()
The kernel doc says this function returns either a valid pointer or an ERR_PTR(), but in practice this function can return NULL if create=false. Fix the function to match the doc (return ERR_PTR(-ENOENT) instead of NULL) and adjust all call-sites accordingly. Fixes: 4bdca1150792 ("drm/panthor: Add the driver frontend block") Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240402141412.1707949-1-harshit.m.mogalapalli@oracle.com
Diffstat (limited to 'drivers/gpu/drm/panthor')
-rw-r--r--drivers/gpu/drm/panthor/panthor_drv.c4
-rw-r--r--drivers/gpu/drm/panthor/panthor_mmu.c2
-rw-r--r--drivers/gpu/drm/panthor/panthor_sched.c2
3 files changed, 5 insertions, 3 deletions
diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c
index 5e3dc701d26d..b8a84f26b3ef 100644
--- a/drivers/gpu/drm/panthor/panthor_drv.c
+++ b/drivers/gpu/drm/panthor/panthor_drv.c
@@ -1090,8 +1090,8 @@ static int panthor_ioctl_tiler_heap_destroy(struct drm_device *ddev, void *data,
return -EINVAL;
pool = panthor_vm_get_heap_pool(vm, false);
- if (!pool) {
- ret = -EINVAL;
+ if (IS_ERR(pool)) {
+ ret = PTR_ERR(pool);
goto out_put_vm;
}
diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c
index a26b40aab261..fa0a002b1016 100644
--- a/drivers/gpu/drm/panthor/panthor_mmu.c
+++ b/drivers/gpu/drm/panthor/panthor_mmu.c
@@ -1897,6 +1897,8 @@ struct panthor_heap_pool *panthor_vm_get_heap_pool(struct panthor_vm *vm, bool c
vm->heaps.pool = panthor_heap_pool_get(pool);
} else {
pool = panthor_heap_pool_get(vm->heaps.pool);
+ if (!pool)
+ pool = ERR_PTR(-ENOENT);
}
mutex_unlock(&vm->heaps.lock);
diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
index a787f2fea33e..d4bc652b34d5 100644
--- a/drivers/gpu/drm/panthor/panthor_sched.c
+++ b/drivers/gpu/drm/panthor/panthor_sched.c
@@ -1343,7 +1343,7 @@ static int group_process_tiler_oom(struct panthor_group *group, u32 cs_id)
if (unlikely(csg_id < 0))
return 0;
- if (!heaps || frag_end > vt_end || vt_end >= vt_start) {
+ if (IS_ERR(heaps) || frag_end > vt_end || vt_end >= vt_start) {
ret = -EINVAL;
} else {
/* We do the allocation without holding the scheduler lock to avoid