Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2138147imj; Sun, 10 Feb 2019 19:45:28 -0800 (PST) X-Google-Smtp-Source: AHgI3IZMPmDW5lkjUByWeSzvJjDKAUw+c5a3+aAgErOWkTZFRnSc0zNTjxugLGs2C/PV8uKckkwh X-Received: by 2002:a17:902:7c82:: with SMTP id y2mr35039921pll.33.1549856728157; Sun, 10 Feb 2019 19:45:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549856728; cv=none; d=google.com; s=arc-20160816; b=GWst+B6plAT1wSip4buTm+4FDgCoR+LSke09PEodsHquXdS28YGtKLO+VhMBZ1qlWq OCM/P6EBHTa4Nrss3Wbb69/jllmyMN4FwJb22//xuGAuqnlc8qeY5yDNUFMA6EsSWPpX G6ZReUqWoxgRO1PL2INZPTweHLHlQxZoMly6It8SPKuMHUhf6Rt7rT4HiX2G3UMLikgb X4UgSq6ZhWosqwR9sXUJ6i5SbGQu3BwQy5ckkRbzkHR3dN4PpczXT2kcuBfk90oHiJM0 oPMIO/2enmgGh1vvUJC+YoAn7MC+rTw0TbugAFnvqmnrR/0tkl7FlaL4GfKGx1bTOFV7 I5Bw== 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=Q/gfMoYQMZ+hkqDcGAJxLb5nnmt0aOI5rtp6JQ6Sk3c=; b=aZsJvWkW3I8K+0SYwNPbeOk+PqCNwZud2/+LBQXZ8Mb5lstJBJ4PT+duEkX4NczgMA eRcSHAZES5Z5gLMFw/IbcKh/GGosvtZu6MJbnlIQ6hus8JLNpYSiKu+1liYqQtJrXu1a MBYUSLXmZULF4I5jFy2MTc9okNK5k8uHRvhgt+Lv4tjGd0Q/H7yNd82ckM7YnkJvnVwn DdNeWT9s5F9tglkLuSI3yL1P29/r+cdIgKPF4WtsremdR/UaVC4hzYpkj3cUoezBrB6r avkorgMc9lLkGw1+TqNYPkVoe+c1JR4aUiF63ccsGToEBN8Q0HAQwI1L1FSXPCor2cb4 Iw4A== 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 a124si9745739pfb.263.2019.02.10.19.45.12; Sun, 10 Feb 2019 19:45:28 -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 S1726838AbfBKDng (ORCPT + 99 others); Sun, 10 Feb 2019 22:43:36 -0500 Received: from mga14.intel.com ([192.55.52.115]:30254 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726102AbfBKDng (ORCPT ); Sun, 10 Feb 2019 22:43:36 -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 fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Feb 2019 19:43:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,357,1544515200"; d="scan'208";a="113906495" 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 19:43:32 -0800 Cc: baolu.lu@linux.intel.com, Bjorn Helgaas , Joerg Roedel , 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.com References: <154966319813.132359.14641436497228395449.stgit@bhelgaas-glaptop.roam.corp.google.com> <154966356809.132359.5318207850182898116.stgit@bhelgaas-glaptop.roam.corp.google.com> <63ae370c-2239-62c5-2378-98916608acc4@linux.intel.com> From: Lu Baolu Message-ID: <886e860a-f620-7b12-2611-228adcfa82c8@linux.intel.com> Date: Mon, 11 Feb 2019 11:38:43 +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: 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/11/19 11:33 AM, Bjorn Helgaas wrote: > On Sun, Feb 10, 2019 at 8:00 PM Lu Baolu wrote: >> >> 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. > > Thanks for your review! Can you clarify your concern? "freelist" > isn't passed into dma_pte_clear_level(). Here's the existing code Oh! Yes, you are right. I confused it with another function. Sorry about it. Best regards, Lu Baolu