From patchwork Thu Mar 15 15:08:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10284725 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 42E82602BD for ; Thu, 15 Mar 2018 15:08:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3169E28A57 for ; Thu, 15 Mar 2018 15:08:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 260DA28B0B; Thu, 15 Mar 2018 15:08:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA78828B1E for ; Thu, 15 Mar 2018 15:08:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752602AbeCOPIg (ORCPT ); Thu, 15 Mar 2018 11:08:36 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:23307 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752815AbeCOPIa (ORCPT ); Thu, 15 Mar 2018 11:08:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1521127619; x=1552663619; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=08iIM7+70EexqKUapMt15JVOSqMhnqwDxtY26FKTz1o=; b=EFmiSnfc/hGFq/ttTg8Gl+pb65DO/ojODQhFBcw2x0LI85VTd9Ga0zXd /gNnTFKYHaS5sAVw7uSeSV9dxmiqIBS/nYB9ivXa3j+swrkjjKMdrEcfk gk1cOUZd24Em5o4khgDctfsE7pAZVYa/q34l82I3/UN6rN3qAUwkGSHgO FIiKHlBWzIC3eszswudh1zFJqjdyrOyB54TuKefgX7zJr48Ga67awgQSz 4hY2hsAf47wh+oILWyPIKhobjWmaB71U7YZWUc6KYtxhHvlY5xw9SiH5+ tTgTp/tGGKgvWX7lXKLFRl1wMUSFaCGq72+/UqoveVwJYZvv/nHGg8o6H Q==; X-IronPort-AV: E=Sophos;i="5.47,471,1515427200"; d="scan'208";a="170233274" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 15 Mar 2018 23:26:38 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 15 Mar 2018 08:01:14 -0700 Received: from thinkpad-bart.sdcorp.global.sandisk.com (HELO thinkpad-bart.int.fusionio.com) ([10.11.171.236]) by uls-op-cesaip02.wdc.com with ESMTP; 15 Mar 2018 08:08:17 -0700 From: Bart Van Assche To: Michael Lyle , Kent Overstreet , Coly Li Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche Subject: [PATCH 12/16] bcache: Make it easier for static analyzers to analyze bch_allocator_thread() Date: Thu, 15 Mar 2018 08:08:10 -0700 Message-Id: <20180315150814.9412-13-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180315150814.9412-1-bart.vanassche@wdc.com> References: <20180315150814.9412-1-bart.vanassche@wdc.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Coly Li --- 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,