Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2073880imj; Sun, 10 Feb 2019 18:01:02 -0800 (PST) X-Google-Smtp-Source: AHgI3IbDdXxZiHEhFZaOWDimkYrfQi6R7xhiajVWkE1R+yLpdxtWL6eYRmpYnEV4eGT3pgiGEr1o X-Received: by 2002:a62:f5d7:: with SMTP id b84mr5251917pfm.36.1549850462703; Sun, 10 Feb 2019 18:01:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549850462; cv=none; d=google.com; s=arc-20160816; b=V7pMLw2/UiOShSbs/2N3daUikXFM0j4bGmH6qQ31m/7MiLk5Z0dgsVYtZpKYtJNqBN 9nxCZCpKxP4OFx46/yGFOhlqgsvUhLRCRJOIc8jbuDW/YxUn6BDufaOKb3LO6sdjRK31 A/6cGGBJL/033Xzt/CW/ZvSoDGVo1bp3rv6s/JK2IzMM1f7w5ZpBvyBMprib/OuqZx+n OhoIRq37JyPPYeSfc4ziPf5BlkL4WdcbJPo/6Uc5/+bw4kWaIPxJfwaByyFOBnYft2Cz Eaf0vZAh+G7EQIt4TPrLqIhy2H8x9Vbui9EWyZAQD2cuBzSnd9PAG19+7snLC5HsXeTE /vuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:cc; bh=aXHtVHbXMSaX6fPCfAAj4Ks0OthpZ4FhI/7BGGtmMic=; b=WLbTMs6DLatzoPFqX9+ihXSjmQUKhzf+a+bxCEejOWAVnPl49MV3CCgQaEAuh5Lpsl 69t2EE12pIfX9jBm4QJNZ9xxz08vb0ENpeah4RrD4sbm+nSqB3Hsgmme1TWwMnRDc2Ak eYOvOXdJ9WXb+MziWi4/it4S3Gyc1ka5DqKbOTkqISBMtlA0IMyjYaGTaxKl4POndqWl zdkcE61XpgbTA2vh/x+4P6ClO2nAFTMqXR/LvOBM9NLZWxlXOLNoUshRTNqh2wpBNQIu rKdFW3LQgwhxgxp1cKS4PvxyRP6hyZRU8yovJ3x/0Ke5eYN/sVJkAho73ZROyxH6pTMa 92TQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m64si8944134pfb.224.2019.02.10.18.00.44; Sun, 10 Feb 2019 18:01:02 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726788AbfBKCAR (ORCPT + 99 others); Sun, 10 Feb 2019 21:00:17 -0500 Received: from mga02.intel.com ([134.134.136.20]:40265 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726101AbfBKCAQ (ORCPT ); Sun, 10 Feb 2019 21:00:16 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Feb 2019 18:00:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,357,1544515200"; d="scan'208";a="113889791" Received: from allen-box.sh.intel.com (HELO [10.239.159.136]) ([10.239.159.136]) by orsmga007.jf.intel.com with ESMTP; 10 Feb 2019 18:00:14 -0800 Cc: baolu.lu@linux.intel.com, David Woodhouse , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 4/7] iommu/vt-d: Remove unnecessary local variable initializations To: Bjorn Helgaas , Joerg Roedel References: <154966319813.132359.14641436497228395449.stgit@bhelgaas-glaptop.roam.corp.google.com> <154966356809.132359.5318207850182898116.stgit@bhelgaas-glaptop.roam.corp.google.com> From: Lu Baolu Message-ID: <63ae370c-2239-62c5-2378-98916608acc4@linux.intel.com> Date: Mon, 11 Feb 2019 09:55:24 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <154966356809.132359.5318207850182898116.stgit@bhelgaas-glaptop.roam.corp.google.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 2/9/19 6:06 AM, Bjorn Helgaas wrote: > From: Bjorn Helgaas > > A local variable initialization is a hint that the variable will be used in > an unusual way. If the initialization is unnecessary, that hint becomes a > distraction. > > Remove unnecessary initializations. No functional change intended. > > Signed-off-by: Bjorn Helgaas > --- > drivers/iommu/intel-iommu.c | 27 +++++++++++++-------------- > 1 file changed, 13 insertions(+), 14 deletions(-) > > diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c > index 81077803880f..2acd08c82cdc 100644 > --- a/drivers/iommu/intel-iommu.c > +++ b/drivers/iommu/intel-iommu.c > @@ -865,7 +865,7 @@ static void free_context_table(struct intel_iommu *iommu) > static struct dma_pte *pfn_to_dma_pte(struct dmar_domain *domain, > unsigned long pfn, int *target_level) > { > - struct dma_pte *parent, *pte = NULL; > + struct dma_pte *parent, *pte; > int level = agaw_to_level(domain->agaw); > int offset; > > @@ -922,7 +922,7 @@ static struct dma_pte *dma_pfn_level_pte(struct dmar_domain *domain, > unsigned long pfn, > int level, int *large_page) > { > - struct dma_pte *parent, *pte = NULL; > + struct dma_pte *parent, *pte; > int total = agaw_to_level(domain->agaw); > int offset; > > @@ -954,7 +954,7 @@ static void dma_pte_clear_range(struct dmar_domain *domain, > unsigned long start_pfn, > unsigned long last_pfn) > { > - unsigned int large_page = 1; > + unsigned int large_page; > struct dma_pte *first_pte, *pte; > > BUG_ON(!domain_pfn_supported(domain, start_pfn)); > @@ -1132,7 +1132,7 @@ static struct page *domain_unmap(struct dmar_domain *domain, > unsigned long start_pfn, > unsigned long last_pfn) > { > - struct page *freelist = NULL; > + struct page *freelist; I am afraid this change might cause problem. "freelist" might go through dma_pte_clear_level() without any touches. Best regards, Lu Baolu