[lvc-project] [PATCH 2/2] [v2] wifi: brcmfmac: handle possible MSI enabling error

Arend van Spriel arend.vanspriel at broadcom.com
Thu Jan 18 15:26:09 MSK 2024


On 6/14/2023 9:58 AM, Dmitry Antipov wrote:
> Handle possible 'pci_enable_msi()' error in
> 'brcmf_pcie_request_irq()', adjust related code.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.

Reviewed-by: Arend van Spriel <arend.vanspriel at broadcom.com>
> Signed-off-by: Dmitry Antipov <dmantipov at yandex.ru>
> ---
> v2: rebase against wireless-next tree
> ---
>   .../net/wireless/broadcom/brcm80211/brcmfmac/pcie.c  | 12 ++++++++----
>   1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
> index 80220685f5e4..f7d9f2cbd60b 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
> @@ -965,6 +965,7 @@ static irqreturn_t brcmf_pcie_isr_thread(int irq, void *arg)
>   
>   static int brcmf_pcie_request_irq(struct brcmf_pciedev_info *devinfo)
>   {
> +	int ret;
>   	struct pci_dev *pdev = devinfo->pdev;
>   	struct brcmf_bus *bus = dev_get_drvdata(&pdev->dev);
>   
> @@ -972,16 +973,19 @@ static int brcmf_pcie_request_irq(struct brcmf_pciedev_info *devinfo)
>   
>   	brcmf_dbg(PCIE, "Enter\n");
>   
> -	pci_enable_msi(pdev);
> +	ret = pci_enable_msi(pdev);
> +	if (ret)
> +		return ret;

The above is sufficient. Further adjustments not needed.

>   	if (request_threaded_irq(pdev->irq, brcmf_pcie_quick_check_isr,
>   				 brcmf_pcie_isr_thread, IRQF_SHARED,
>   				 "brcmf_pcie_intr", devinfo)) {
>   		pci_disable_msi(pdev);
>   		brcmf_err(bus, "Failed to request IRQ %d\n", pdev->irq);
> -		return -EIO;
> +		ret = -EIO;
> +	} else {
> +		devinfo->irq_allocated = true;
>   	}
> -	devinfo->irq_allocated = true;
> -	return 0;
> +	return ret;
>   }
>   
>   
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4219 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://linuxtesting.org/pipermail/lvc-project/attachments/20240118/284b7bab/attachment.bin>


More information about the lvc-project mailing list