diff mbox series

[09/16] PCI/ERR: Report current recovery status for udev

Message ID 20180831212639.10196-10-keith.busch@intel.com (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show
Series PCI, error handling and hot plug | expand

Commit Message

Keith Busch Aug. 31, 2018, 9:26 p.m. UTC
A device still participates in error recovery even if it doesn't have
the error callbacks. This patch provides the status for user event
watchers.

Signed-off-by: Keith Busch <keith.busch@intel.com>
---
 drivers/pci/pcie/err.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Christoph Hellwig Sept. 1, 2018, 8:36 a.m. UTC | #1
On Fri, Aug 31, 2018 at 03:26:32PM -0600, Keith Busch wrote:
> A device still participates in error recovery even if it doesn't have
> the error callbacks. This patch provides the status for user event
> watchers.
> 
> Signed-off-by: Keith Busch <keith.busch@intel.com>
> ---
>  drivers/pci/pcie/err.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c
> index ee9014615add..a42a17a851fb 100644
> --- a/drivers/pci/pcie/err.c
> +++ b/drivers/pci/pcie/err.c
> @@ -67,12 +67,12 @@ static int report_error_detected(struct pci_dev *dev,
>  			vote = PCI_ERS_RESULT_NO_AER_DRIVER;
>  		else
>  			vote = PCI_ERS_RESULT_NONE;
> +		goto out;
>  	}
> -
> +	err_handler = dev->driver->err_handler;
> +	vote = err_handler->error_detected(dev, state);
> +out:
> +	pci_uevent_ers(dev, vote);
>  	*result = merge_result(*result, vote);
>  	device_unlock(&dev->dev);
>  	return 0;

The goto out looks a little odd here.  Why not keep the else
and just move the uevent notification out of it?
diff mbox series

Patch

diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c
index ee9014615add..a42a17a851fb 100644
--- a/drivers/pci/pcie/err.c
+++ b/drivers/pci/pcie/err.c
@@ -67,12 +67,12 @@  static int report_error_detected(struct pci_dev *dev,
 			vote = PCI_ERS_RESULT_NO_AER_DRIVER;
 		else
 			vote = PCI_ERS_RESULT_NONE;
-	} else {
-		err_handler = dev->driver->err_handler;
-		vote = err_handler->error_detected(dev, state);
-		pci_uevent_ers(dev, PCI_ERS_RESULT_NONE);
+		goto out;
 	}
-
+	err_handler = dev->driver->err_handler;
+	vote = err_handler->error_detected(dev, state);
+out:
+	pci_uevent_ers(dev, vote);
 	*result = merge_result(*result, vote);
 	device_unlock(&dev->dev);
 	return 0;
@@ -140,8 +140,8 @@  static int report_resume(struct pci_dev *dev, void *data)
 
 	err_handler = dev->driver->err_handler;
 	err_handler->resume(dev);
-	pci_uevent_ers(dev, PCI_ERS_RESULT_RECOVERED);
 out:
+	pci_uevent_ers(dev, PCI_ERS_RESULT_RECOVERED);
 	device_unlock(&dev->dev);
 	return 0;
 }