Thread (51 messages) 51 messages, 4 authors, 2018-03-17
STALE3048d

[PATCH 12/16] bcache: Make it easier for static analyzers to analyze bch_allocator_thread()

From: Bart Van Assche <hidden>
Date: 2018-03-15 15:08:30
Subsystem: bcache (block layer cache), the rest · Maintainers: Coly Li, Kent Overstreet, Linus Torvalds

This patch does not change any functionality but avoids that smatch
reports the following:

drivers/md/bcache/alloc.c:334: bch_allocator_thread() error: uninitialized symbol 'bucket'.

Signed-off-by: Bart Van Assche <redacted>
---
 drivers/md/bcache/alloc.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/md/bcache/alloc.c b/drivers/md/bcache/alloc.c
index 458e1d38577d..6a98d48c5f5f 100644
--- a/drivers/md/bcache/alloc.c
+++ b/drivers/md/bcache/alloc.c
@@ -316,6 +316,7 @@ static int bch_allocator_push(struct cache *ca, long bucket)
 static int bch_allocator_thread(void *arg)
 {
 	struct cache *ca = arg;
+	long bucket;
 
 	mutex_lock(&ca->set->bucket_lock);
 
@@ -325,11 +326,7 @@ static int bch_allocator_thread(void *arg)
 		 * possibly issue discards to them, then we add the bucket to
 		 * the free list:
 		 */
-		while (!fifo_empty(&ca->free_inc)) {
-			long bucket;
-
-			fifo_pop(&ca->free_inc, bucket);
-
+		while (fifo_pop(&ca->free_inc, bucket)) {
 			if (ca->discard) {
 				mutex_unlock(&ca->set->bucket_lock);
 				blkdev_issue_discard(ca->bdev,
-- 
2.16.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help