diff mbox

[4/8] pcie, aer: init struct aer_err_info for reuse

Message ID 4A8E18AA.8080702@jp.fujitsu.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Hidetoshi Seto Aug. 21, 2009, 3:46 a.m. UTC
In case of multiple errors, struct aer_err_info would be reused among
all reported devices.  So the info->status should be initialized before
recycled.  Otherwise error of one device might be reported as the error
of another device.  Also info->flags has similar problem on reporting
TLP header.

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
---
 drivers/pci/pcie/aer/aerdrv_core.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Comments

Andrew Patterson Aug. 26, 2009, 11:12 p.m. UTC | #1
On Fri, 2009-08-21 at 12:46 +0900, Hidetoshi Seto wrote:
> In case of multiple errors, struct aer_err_info would be reused among
> all reported devices.  So the info->status should be initialized before
> recycled.  Otherwise error of one device might be reported as the error
> of another device.  Also info->flags has similar problem on reporting
> TLP header.
> 
> Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
> ---
>  drivers/pci/pcie/aer/aerdrv_core.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c
> index d3f6df4..4d67db8 100644
> --- a/drivers/pci/pcie/aer/aerdrv_core.c
> +++ b/drivers/pci/pcie/aer/aerdrv_core.c
> @@ -708,6 +708,9 @@ static int get_device_error_info(struct pci_dev *dev, struct aer_err_info *info)
>  {
>  	int pos;
>  
> +	info->status = 0;
> +	info->flags &= ~AER_TLP_HEADER_VALID_FLAG;
> +

It seems a little strange to me to see this initialization here.  I
guess I would expect to see it in aer_process_err_devices() inside the
for loop.  Perhaps using a call to an "initialization" routine. This is
a personal style issue. Feel free to ignore it.

>  	pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR);
>  
>  	/* The device might not support AER */
diff mbox

Patch

diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c
index d3f6df4..4d67db8 100644
--- a/drivers/pci/pcie/aer/aerdrv_core.c
+++ b/drivers/pci/pcie/aer/aerdrv_core.c
@@ -708,6 +708,9 @@  static int get_device_error_info(struct pci_dev *dev, struct aer_err_info *info)
 {
 	int pos;
 
+	info->status = 0;
+	info->flags &= ~AER_TLP_HEADER_VALID_FLAG;
+
 	pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR);
 
 	/* The device might not support AER */