Re: [PATCH v3 6/6] PCI: brcmstb: Check return value of clk_prepare_enable()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 26, 2021 at 03:19:04PM -0400, Jim Quinlan wrote:
> The check was missing on PCIe resume.

"PCIe resume" isn't really a thing, per se.  PCI/PCIe gives us device
power states (D0, D3hot, etc), and Linux power management builds
suspend/resume on top of those.  Maybe:

  Check for failure of clk_prepare_enable() on device resume.

> Signed-off-by: Jim Quinlan <jim2101024@xxxxxxxxx>
> Acked-by: Florian Fainelli <f.fainelli@xxxxxxxxx>
> Fixes: 8195b7417018 ("PCI: brcmstb: Add suspend and resume pm_ops")
> ---
>  drivers/pci/controller/pcie-brcmstb.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c
> index 2d9288399014..f6d9d785b301 100644
> --- a/drivers/pci/controller/pcie-brcmstb.c
> +++ b/drivers/pci/controller/pcie-brcmstb.c
> @@ -1396,7 +1396,9 @@ static int brcm_pcie_resume(struct device *dev)
>  	int ret;
>  
>  	base = pcie->base;
> -	clk_prepare_enable(pcie->clk);
> +	ret = clk_prepare_enable(pcie->clk);
> +	if (ret)
> +		return ret;

This fix doesn't look like it depends on the EP regulator support.
Maybe it should be a preparatory patch before patch 1/6?  It could
then easily be backported to kernels that contain 8195b7417018 but not
EP regulator support.

>  	ret = brcm_set_regulators(pcie, TURN_ON);
>  	if (ret)
> @@ -1535,7 +1537,9 @@ static int brcm_pcie_probe(struct platform_device *pdev)
>  
>  	ret = brcm_pcie_get_regulators(pcie);
>  	if (ret) {
> -		dev_err(pcie->dev, "failed to get regulators (err=%d)\n", ret);
> +		pcie->num_supplies = 0;
> +		if (ret != -EPROBE_DEFER)
> +			dev_err(pcie->dev, "failed to get regulators (err=%d)\n", ret);

Looks like this hunk might belong somewhere else, e.g., in patch 2/6?
The "Fixes:" line suggests that this patch could/should be backported to
every kernel that contains 8195b7417018, but 8195b7417018 doesn't have
pcie->num_supplies.

>  		goto fail;
>  	}
>  
> -- 
> 2.17.1
> 



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux