From patchwork Sat Sep 19 11:02:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhen Lei X-Patchwork-Id: 11786967 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3765959D for ; Sat, 19 Sep 2020 11:03:21 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DD14A208C3 for ; Sat, 19 Sep 2020 11:03:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DD14A208C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvdimm-bounces@lists.01.org Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 85027152A36F3; Sat, 19 Sep 2020 04:03:20 -0700 (PDT) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=45.249.212.32; helo=huawei.com; envelope-from=thunder.leizhen@huawei.com; receiver= Received: from huawei.com (szxga06-in.huawei.com [45.249.212.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 663B1152A36F0 for ; Sat, 19 Sep 2020 04:03:05 -0700 (PDT) Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 3D190658BE13BBBCAC36; Sat, 19 Sep 2020 19:03:03 +0800 (CST) Received: from thunder-town.china.huawei.com (10.174.177.253) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.487.0; Sat, 19 Sep 2020 19:02:57 +0800 From: Zhen Lei To: Oliver O'Halloran , Dan Williams , Vishal Verma , "Dave Jiang" , Ira Weiny , Markus Elfring , linux-nvdimm , linux-kernel Subject: [PATCH v2 1/1] libnvdimm/region: delete a piece of useless code in nd_region_create() Date: Sat, 19 Sep 2020 19:02:45 +0800 Message-ID: <20200919110245.3965-1-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.174.177.253] X-CFilter-Loop: Reflected Message-ID-Hash: 3RIDRTQZXRQJE5JL7XSJYA5U7ARICYCL X-Message-ID-Hash: 3RIDRTQZXRQJE5JL7XSJYA5U7ARICYCL X-MailFrom: thunder.leizhen@huawei.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation CC: Zhen Lei , Libin , Kefeng Wang X-Mailman-Version: 3.1.1 Precedence: list List-Id: "Linux-nvdimm developer list." Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: The code snippet is as follows: if (ndr_desc->flush) 1) nd_region->flush = ndr_desc->flush; else 2) nd_region->flush = NULL; When entering the "else" branch, the value of ndr_desc->flush is NULL. After replaced "NULL" with "ndr_desc->flush" at 2), we will find that it becomes the same to 1). So the above code snippet can be reduced to one statement: nd_region->flush = ndr_desc->flush; No functional change. Signed-off-by: Zhen Lei --- v1 --> v2: 1. Only the title and description are modified. v1: https://lkml.org/lkml/2020/8/19/1469 drivers/nvdimm/region_devs.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c index ef23119db574663..7cf9c7d857909ce 100644 --- a/drivers/nvdimm/region_devs.c +++ b/drivers/nvdimm/region_devs.c @@ -1131,10 +1131,7 @@ static struct nd_region *nd_region_create(struct nvdimm_bus *nvdimm_bus, nd_region->ndr_size = resource_size(ndr_desc->res); nd_region->ndr_start = ndr_desc->res->start; nd_region->align = default_align(nd_region); - if (ndr_desc->flush) - nd_region->flush = ndr_desc->flush; - else - nd_region->flush = NULL; + nd_region->flush = ndr_desc->flush; nd_device_register(dev);