Subject: Re: [PATCH net] bnx2x: fix pci device refcount leak in bnx2x_vf_is_pcie_pending()

From: Jakub Kicinski <[email-masked]>
Date: Fri, 18 Nov 2022 18:52:52 -0800

On Thu, 17 Nov 2022 20:33:01 +0800 Yang Yingliang wrote:
> diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
> index 11d15cd03600..cd5108b38542 100644
> --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
> +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
> @@ -802,8 +802,11 @@ static u8 bnx2x_vf_is_pcie_pending(struct bnx2x *bp, u8 abs_vfid)
>  		return false;
>  
>  	dev = pci_get_domain_bus_and_slot(vf->domain, vf->bus, vf->devfn);
> -	if (dev)
> -		return bnx2x_is_pcie_pending(dev);
> +	if (dev) {
> +		bool pending = bnx2x_is_pcie_pending(dev);
> +		pci_dev_put(dev);
> +		return pending;
> +	}
>  	return false;

Success path should be unindented:

	dev = pci_get..
	if (!dev)
		return false;
	pending = bnxt2x_is_...
	pci_dev_put(dev);

	return pending;

Please use get_maintainers on the formatted patch file to find all 
the people to CC.