From: Lu Baolu <baolu.lu@linux.intel.com>
To: bjorn@helgaas.com
Cc: baolu.lu@linux.intel.com, Bjorn Helgaas <helgaas@kernel.org>,
Joerg Roedel <joro@8bytes.org>,
David Woodhouse <dwmw2@infradead.org>,
iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 4/7] iommu/vt-d: Remove unnecessary local variable initializations
Date: Mon, 11 Feb 2019 11:38:43 +0800 [thread overview]
Message-ID: <886e860a-f620-7b12-2611-228adcfa82c8@linux.intel.com> (raw)
In-Reply-To: <CABhMZUUKe0b9RkscDX6WR0tpQmhW_nFoYKHTvthpKwZ4vMirOA@mail.gmail.com>
Hi,
On 2/11/19 11:33 AM, Bjorn Helgaas wrote:
> On Sun, Feb 10, 2019 at 8:00 PM Lu Baolu <baolu.lu@linux.intel.com> wrote:
>>
>> Hi,
>>
>> On 2/9/19 6:06 AM, Bjorn Helgaas wrote:
>>> From: Bjorn Helgaas <bhelgaas@google.com>
>>>
>>> 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 <bhelgaas@google.com>
>>> ---
>>> 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
next prev parent reply other threads:[~2019-02-11 3:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-08 22:05 [PATCH v1 0/7] iommu: Minor cleanups and dev_printk() usage Bjorn Helgaas
2019-02-08 22:05 ` [PATCH v1 1/7] iommu: Use dev_printk() when possible Bjorn Helgaas
2019-02-08 22:05 ` [PATCH v1 2/7] iommu/amd: " Bjorn Helgaas
2019-02-08 22:06 ` [PATCH v1 3/7] iommu/vt-d: " Bjorn Helgaas
2019-02-08 22:06 ` [PATCH v1 4/7] iommu/vt-d: Remove unnecessary local variable initializations Bjorn Helgaas
2019-02-11 1:55 ` Lu Baolu
2019-02-11 3:33 ` Bjorn Helgaas
2019-02-11 3:38 ` Lu Baolu [this message]
2019-02-08 22:06 ` [PATCH v1 5/7] iommu/vt-d: Remove unused dmar_remove_one_dev_info() argument Bjorn Helgaas
2019-02-08 22:06 ` [PATCH v1 6/7] iommu/vt-d: Remove misleading "domain 0" test from domain_exit() Bjorn Helgaas
2019-02-08 22:06 ` [PATCH v1 7/7] iommu/vt-d: Simplify control flow Bjorn Helgaas
2019-02-11 11:09 ` [PATCH v1 0/7] iommu: Minor cleanups and dev_printk() usage Joerg Roedel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=886e860a-f620-7b12-2611-228adcfa82c8@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=bjorn@helgaas.com \
--cc=dwmw2@infradead.org \
--cc=helgaas@kernel.org \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®