From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38625) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1rLm-0001rt-Cs for qemu-devel@nongnu.org; Wed, 02 Nov 2016 04:56:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c1rLj-0003EJ-71 for qemu-devel@nongnu.org; Wed, 02 Nov 2016 04:56:50 -0400 Received: from [59.151.112.132] (port=12146 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1rLi-000359-Nu for qemu-devel@nongnu.org; Wed, 02 Nov 2016 04:56:47 -0400 References: <1476325947-28268-1-git-send-email-caoj.fnst@cn.fujitsu.com> From: Cao jin Message-ID: <5819AACD.3060601@cn.fujitsu.com> Date: Wed, 2 Nov 2016 16:58:53 +0800 MIME-Version: 1.0 In-Reply-To: <1476325947-28268-1-git-send-email-caoj.fnst@cn.fujitsu.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] pci_aer_init: cleanup List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: marcel@redhat.com, mst@redhat.com ping On 10/13/2016 10:32 AM, Cao jin wrote: > log_max have no chance to be PCIE_AER_LOG_MAX_UNSET, unless user specify it. > > Bonus: > 1. remove unnecessary local variable. > 2. fix a typo. > > Signed-off-by: Cao jin > --- > hw/pci/pcie_aer.c | 10 +--------- > include/hw/pci/pcie_aer.h | 2 +- > 2 files changed, 2 insertions(+), 10 deletions(-) > > diff --git a/hw/pci/pcie_aer.c b/hw/pci/pcie_aer.c > index ac47f34..6cf088b 100644 > --- a/hw/pci/pcie_aer.c > +++ b/hw/pci/pcie_aer.c > @@ -99,18 +99,10 @@ static void aer_log_clear_all_err(PCIEAERLog *aer_log) > int pcie_aer_init(PCIDevice *dev, uint8_t cap_ver, uint16_t offset, > uint16_t size) > { > - PCIExpressDevice *exp; > - > pcie_add_capability(dev, PCI_EXT_CAP_ID_ERR, cap_ver, > offset, size); > - exp = &dev->exp; > - exp->aer_cap = offset; > + dev->exp.aer_cap = offset; > > - /* log_max is property */ > - if (dev->exp.aer_log.log_max == PCIE_AER_LOG_MAX_UNSET) { > - dev->exp.aer_log.log_max = PCIE_AER_LOG_MAX_DEFAULT; > - } > - /* clip down the value to avoid unreasobale memory usage */ > if (dev->exp.aer_log.log_max > PCIE_AER_LOG_MAX_LIMIT) { > return -EINVAL; > } > diff --git a/include/hw/pci/pcie_aer.h b/include/hw/pci/pcie_aer.h > index c373591..31755ef 100644 > --- a/include/hw/pci/pcie_aer.h > +++ b/include/hw/pci/pcie_aer.h > @@ -40,7 +40,7 @@ struct PCIEAERLog { > * The specified value will be clipped down to PCIE_AER_LOG_MAX_LIMIT > * to avoid unreasonable memory usage. > * I bet that 128 log size would be big enough, otherwise too many errors > - * for system to function normaly. But could consecutive errors occur? > + * for system to function normally. But could consecutive errors occur? > */ > #define PCIE_AER_LOG_MAX_DEFAULT 8 > #define PCIE_AER_LOG_MAX_LIMIT 128 > -- Yours Sincerely, Cao jin