[bug report] drm: kselftest for drm_mm and eviction
Chris Wilson
chris at chris-wilson.co.uk
Tue Jan 10 14:29:59 UTC 2017
On Tue, Jan 10, 2017 at 05:17:46PM +0300, Dan Carpenter wrote:
> Hello Chris Wilson,
>
> The patch 560b32842912: "drm: kselftest for drm_mm and eviction" from
> Dec 22, 2016, leads to the following static checker warning:
>
> drivers/gpu/drm/selftests/test-drm_mm.c:1277 evict_everything()
> warn: calling list_del() inside list_for_each
>
> drivers/gpu/drm/selftests/test-drm_mm.c
> 1260 static bool evict_everything(struct drm_mm *mm,
> 1261 unsigned int total_size,
> 1262 struct evict_node *nodes)
> 1263 {
> 1264 struct drm_mm_scan scan;
> 1265 LIST_HEAD(evict_list);
> 1266 struct evict_node *e;
> 1267 unsigned int n;
> 1268 int err;
> 1269
> 1270 drm_mm_scan_init(&scan, mm, total_size, 0, 0, 0);
> 1271 for (n = 0; n < total_size; n++) {
> 1272 e = &nodes[n];
> 1273 list_add(&e->link, &evict_list);
> 1274 if (drm_mm_scan_add_block(&scan, &e->node))
> 1275 break;
> 1276 }
> 1277 list_for_each_entry(e, &evict_list, link) {
> 1278 if (!drm_mm_scan_remove_block(&scan, &e->node)) {
> 1279 pr_err("Node %lld not marked for eviction!\n",
> 1280 e->node.start);
> 1281 list_del(&e->link);
>
> Probably this should be using list_for_each_entry_safe(), I guess?
It can be a return false; (or something along those lines) since after
finding the first error, there are likely plenty more.
Thanks for catching this.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the dri-devel
mailing list