All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Bjorn Helgaas <helgaas@kernel.org>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Juergen Gross <jgross@suse.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Stefano Stabellini <sstabellini@kernel.org>,
	kernel@pengutronix.de, linux-pci@vger.kernel.org,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v3 3/8] xen/pci: Drop some checks that are always true
Date: Wed, 11 Aug 2021 11:51:19 +0200	[thread overview]
Message-ID: <20210811095119.qxwhsexayjq6xhmx@pengutronix.de> (raw)
In-Reply-To: <20210811080637.2596434-4-u.kleine-koenig@pengutronix.de>

[-- Attachment #1: Type: text/plain, Size: 3385 bytes --]

This mail didn't reach all intended recipients as there was a newline at
the wrong place in the input for git send-email. I fixed this up for
this reply, please make sure to do the same if you reply to this patch.
The other patches in this thread should be fine. I'm keeping the mail
content below to facilitate replying.

Sorry for the inconvenience,
Uwe

On Wed, Aug 11, 2021 at 10:06:32AM +0200, Uwe Kleine-König wrote:
> pcifront_common_process() has a check at the start that exits early if
> pcidev or pdidev->driver are NULL. So simplify the following code by not
> checking these two again.
> 
> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/pci/xen-pcifront.c | 57 +++++++++++++++++---------------------
>  1 file changed, 25 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
> index b7a8f3a1921f..3c648e6cb8f8 100644
> --- a/drivers/pci/xen-pcifront.c
> +++ b/drivers/pci/xen-pcifront.c
> @@ -591,7 +591,6 @@ static pci_ers_result_t pcifront_common_process(int cmd,
>  	int devfn = pdev->sh_info->aer_op.devfn;
>  	int domain = pdev->sh_info->aer_op.domain;
>  	struct pci_dev *pcidev;
> -	int flag = 0;
>  
>  	dev_dbg(&pdev->xdev->dev,
>  		"pcifront AER process: cmd %x (bus:%x, devfn%x)",
> @@ -606,40 +605,34 @@ static pci_ers_result_t pcifront_common_process(int cmd,
>  	}
>  	pdrv = pcidev->driver;
>  
> -	if (pdrv) {
> -		if (pdrv->err_handler && pdrv->err_handler->error_detected) {
> -			pci_dbg(pcidev, "trying to call AER service\n");
> -			if (pcidev) {
> -				flag = 1;
> -				switch (cmd) {
> -				case XEN_PCI_OP_aer_detected:
> -					result = pdrv->err_handler->
> -						 error_detected(pcidev, state);
> -					break;
> -				case XEN_PCI_OP_aer_mmio:
> -					result = pdrv->err_handler->
> -						 mmio_enabled(pcidev);
> -					break;
> -				case XEN_PCI_OP_aer_slotreset:
> -					result = pdrv->err_handler->
> -						 slot_reset(pcidev);
> -					break;
> -				case XEN_PCI_OP_aer_resume:
> -					pdrv->err_handler->resume(pcidev);
> -					break;
> -				default:
> -					dev_err(&pdev->xdev->dev,
> -						"bad request in aer recovery "
> -						"operation!\n");
> -
> -				}
> -			}
> +	if (pdrv->err_handler && pdrv->err_handler->error_detected) {
> +		pci_dbg(pcidev, "trying to call AER service\n");
> +		switch (cmd) {
> +		case XEN_PCI_OP_aer_detected:
> +			result = pdrv->err_handler->
> +				 error_detected(pcidev, state);
> +			break;
> +		case XEN_PCI_OP_aer_mmio:
> +			result = pdrv->err_handler->
> +				 mmio_enabled(pcidev);
> +			break;
> +		case XEN_PCI_OP_aer_slotreset:
> +			result = pdrv->err_handler->
> +				 slot_reset(pcidev);
> +			break;
> +		case XEN_PCI_OP_aer_resume:
> +			pdrv->err_handler->resume(pcidev);
> +			break;
> +		default:
> +			dev_err(&pdev->xdev->dev,
> +				"bad request in aer recovery "
> +				"operation!\n");
>  		}
> +
> +		return result;
>  	}
> -	if (!flag)
> -		result = PCI_ERS_RESULT_NONE;
>  
> -	return result;
> +	return PCI_ERS_RESULT_NONE;
>  }
>  
>  
> -- 
> 2.30.2
> 
> 
> 

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2021-08-11  9:51 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-11  8:06 [PATCH v3 0/8] PCI: Drop duplicated tracking of a pci_dev's bound driver Uwe Kleine-König
2021-08-11  8:06 ` Uwe Kleine-König
2021-08-11  8:06 ` [PATCH v3 1/8] PCI: Simplify pci_device_remove() Uwe Kleine-König
2021-08-12  6:44   ` Christoph Hellwig
2021-08-11  8:06 ` [PATCH v3 2/8] PCI: Drop useless check from pci_device_probe() Uwe Kleine-König
2021-08-12  6:46   ` Christoph Hellwig
2021-08-11  8:06 ` [PATCH v3 3/8] xen/pci: Drop some checks that are always true Uwe Kleine-König
2021-08-11  9:51   ` Uwe Kleine-König [this message]
2021-08-12  6:50   ` Christoph Hellwig
2021-08-11  8:06 ` [PATCH v3 4/8] PCI: replace pci_dev::driver usage that gets the driver name Uwe Kleine-König
2021-08-11  8:06   ` Uwe Kleine-König
2021-08-12  7:07   ` Christoph Hellwig
2021-08-12  7:07     ` Christoph Hellwig
2021-08-12  8:14     ` Uwe Kleine-König
2021-08-12  8:14       ` Uwe Kleine-König
2021-08-14  8:38       ` Christoph Hellwig
2021-08-14  8:38         ` Christoph Hellwig
2021-08-11  8:06 ` [PATCH v3 5/8] scsi: message: fusion: Remove unused parameter of mpt_pci driver's probe() Uwe Kleine-König
2021-08-12  2:51   ` Martin K. Petersen
2021-08-12  7:10   ` Christoph Hellwig
2021-08-11  8:06 ` [PATCH v3 6/8] crypto: qat - simplify adf_enable_aer() Uwe Kleine-König
2021-08-11 11:56   ` Giovanni Cabiddu
2021-08-11 21:34     ` Uwe Kleine-König
2021-08-12 14:43       ` Giovanni Cabiddu
2021-08-13  8:15         ` Uwe Kleine-König
2021-08-11  8:06 ` [PATCH v3 7/8] PCI: Replace pci_dev::driver usage by pci_dev::dev.driver Uwe Kleine-König
2021-08-11  8:06   ` Uwe Kleine-König
2021-08-11 14:07   ` Boris Ostrovsky
2021-08-11 14:07     ` Boris Ostrovsky
2021-08-11  8:06 ` [PATCH v3 8/8] PCI: Drop duplicated tracking of a pci_dev's bound driver Uwe Kleine-König

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=20210811095119.qxwhsexayjq6xhmx@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=boris.ostrovsky@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=helgaas@kernel.org \
    --cc=jgross@suse.com \
    --cc=kernel@pengutronix.de \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.