summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-01-10 14:40:31 +0000
committerDaniel Vetter <daniel.vetter@ffwll.ch>2017-01-11 08:53:34 +0100
commit95b8c64afad824014178df6b396c6ba0f4b1b80a (patch)
tree9519aa49a997e6e17073c0478885aeaa3099503b /drivers/gpu/drm
parentfc36ec76f3f6a6578086b5c045322805df0b9d83 (diff)
downloadlinux-95b8c64afad824014178df6b396c6ba0f4b1b80a.tar.bz2
drm: Fix error handling in drm_mm eviction kselftest
drivers/gpu/drm/selftests/test-drm_mm.c:1277 evict_everything() warn: calling list_del() inside list_for_each The list_del() inside the error handling in the eviction loop is overkill. We have to undo the eviction scan to return the drm_mm back to a recoverable state, so have to iterate over the full list, but we only want to report the error once and once we have an error we can return early. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Fixes: 560b32842912 ("drm: kselftest for drm_mm and eviction") Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/20170110144031.7609-1-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/selftests/test-drm_mm.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/gpu/drm/selftests/test-drm_mm.c b/drivers/gpu/drm/selftests/test-drm_mm.c
index 6d2a5cd211f3..6df53e6c1308 100644
--- a/drivers/gpu/drm/selftests/test-drm_mm.c
+++ b/drivers/gpu/drm/selftests/test-drm_mm.c
@@ -1274,13 +1274,19 @@ static bool evict_everything(struct drm_mm *mm,
if (drm_mm_scan_add_block(&scan, &e->node))
break;
}
+
+ err = 0;
list_for_each_entry(e, &evict_list, link) {
if (!drm_mm_scan_remove_block(&scan, &e->node)) {
- pr_err("Node %lld not marked for eviction!\n",
- e->node.start);
- list_del(&e->link);
+ if (!err) {
+ pr_err("Node %lld not marked for eviction!\n",
+ e->node.start);
+ err = -EINVAL;
+ }
}
}
+ if (err)
+ return false;
list_for_each_entry(e, &evict_list, link)
drm_mm_remove_node(&e->node);