Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp574514imm; Sat, 8 Sep 2018 04:53:57 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZBf2chr2sqxvVZyaaqD9c1Tbinglr6taY02IO5yz9IAuypdjP3R721uGwfFPnziK62HWnk X-Received: by 2002:a17:902:b60e:: with SMTP id b14-v6mr12555476pls.111.1536407637403; Sat, 08 Sep 2018 04:53:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536407637; cv=none; d=google.com; s=arc-20160816; b=mdEVhOnkq6vQTZ3GyqmJL5LDrMGz1IqDBgGaP/iY2id2Frjg843rPIharyt5rB4q1U nkOPN06DhJjaQRwOFGBcEJ/HZcmPx8/ptj7IF2lx+pRmaM9/3z3NfrAT7H/vTuwMRgLJ e7lS3vc7XtkCbm2MaDKkbLVaPV/fBReKEV0xxqcjG94RPl+Fg9WgL1aG4xaHN2emJhP2 Mi3iwi6z1fTFObA0ctNNoLR+TsIginyWAd7dm4YkWbqYd3F89TGvc4SgSuFBJF5YotyT yo2KtgF+YRSe+LwWc7MItZJYlZBmGUxkTwwQHoi3JUVyzjBJQEB0/4GM88ZXNhfVijJX l1WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=csIvDqt5k+slsYGnJKO4bM3Y7xjWWyVtFp3bMUErmMo=; b=BP+/WvXeiXjKKCkh6lNmJ9leDtQP2qbsI8dHr3r6zWsOoJHKA6X9ndXs3HJ/1tLZht ld05FD58twzm0b8xEPGaJesNW/dmuzhx3PiVsx8RdV7B3gK2U3nQpj3/9pU0OFMcMUuO PqRPejGgA7PHitzjKywwa/yqmXB+MII2KIH1IAev03F3CNA6jqdS9H3TyJzFzPfFOgBw XCpTUlGBXGu1FulOzR2ANxReIJJlXfuJm3aycPMIzdX4wJdrC2ESvQgizJoH7YYKROEo 5xzSXaQ39HAOpczJVUHJ/o813U/LLIey4oK1NFFiVe7QbX2uS9n9sBF/B1Qz89ZoSENq dzoQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bh12-v6si10086818plb.425.2018.09.08.04.53.26; Sat, 08 Sep 2018 04:53:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726641AbeIHQhM (ORCPT + 99 others); Sat, 8 Sep 2018 12:37:12 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:42216 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726443AbeIHQhM (ORCPT ); Sat, 8 Sep 2018 12:37:12 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 21E367E552AF3; Sat, 8 Sep 2018 19:51:38 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.399.0; Sat, 8 Sep 2018 19:51:37 +0800 From: zhong jiang To: , CC: , Subject: [PATCH] bcache: remove unnecessary null poiner check in cache_set_free Date: Sat, 8 Sep 2018 19:39:26 +0800 Message-ID: <1536406766-27021-1-git-send-email-zhongjiang@huawei.com> X-Mailer: git-send-email 1.7.12.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The iterator in for_each_cache is never null, therefore, remove the redundant null pointer check. Signed-off-by: zhong jiang --- drivers/md/bcache/super.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 94c756c..2d26f9e 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -1513,12 +1513,11 @@ static void cache_set_free(struct closure *cl) bch_btree_cache_free(c); bch_journal_free(c); - for_each_cache(ca, c, i) - if (ca) { - ca->set = NULL; - c->cache[ca->sb.nr_this_dev] = NULL; - kobject_put(&ca->kobj); - } + for_each_cache(ca, c, i) { + ca->set = NULL; + c->cache[ca->sb.nr_this_dev] = NULL; + kobject_put(&ca->kobj); + } bch_bset_sort_state_free(&c->sort); free_pages((unsigned long) c->uuids, ilog2(bucket_pages(c))); -- 1.7.12.4