All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: chris@chris-wilson.co.uk
Cc: dri-devel@lists.freedesktop.org
Subject: [bug report] drm: kselftest for drm_mm and eviction
Date: Tue, 10 Jan 2017 17:17:46 +0300	[thread overview]
Message-ID: <20170110141745.GA28229@elgon.mountain> (raw)

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?

  1282                  }
  1283          }
  1284  
  1285          list_for_each_entry(e, &evict_list, link)
  1286                  drm_mm_remove_node(&e->node);
  1287  
  1288          if (!assert_one_hole(mm, 0, total_size))
  1289                  return false;
  1290  
  1291          list_for_each_entry(e, &evict_list, link) {
  1292                  err = drm_mm_reserve_node(mm, &e->node);
  1293                  if (err) {
  1294                          pr_err("Failed to reinsert node after eviction: start=%llx\n",
  1295                                 e->node.start);
  1296                          return false;
  1297                  }
  1298          }
  1299  
  1300          return assert_continuous(mm, nodes[0].node.size);
  1301  }

regards,
dan carpenter
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

             reply	other threads:[~2017-01-10 14:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-10 14:17 Dan Carpenter [this message]
2017-01-10 14:29 ` [bug report] drm: kselftest for drm_mm and eviction Chris Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170110141745.GA28229@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.