Re: [PATCH 1/2] PCI: imx: Fix probe failure without power domain

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

 



On Mon, Jan 21, 2019 at 10:50:04PM +0000, Leonard Crestez wrote:
> On chips without a separate power domain for PCI (such as 6q/6qp) the
> imx6_pcie_attach_pd function incorrectly returns an error.
> 
> Fix by returning 0 if dev_pm_domain_attach_by_name doesn't find
> anything.
> 
> Fixes: 3f7cceeab895 ("PCI: imx: Add multi-pd support")
> Reported-by: Lukas F.Hartmann <lukas@xxxxxxxxx>
> Signed-off-by: Leonard Crestez <leonard.crestez@xxxxxxx>
> ---
>  drivers/pci/controller/dwc/pci-imx6.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
> index 52e47dac028f..ac5f6ae0b254 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c
> @@ -308,10 +308,13 @@ static int imx6_pcie_attach_pd(struct device *dev)
>  		return 0;
>  
>  	imx6_pcie->pd_pcie = dev_pm_domain_attach_by_name(dev, "pcie");
>  	if (IS_ERR(imx6_pcie->pd_pcie))
>  		return PTR_ERR(imx6_pcie->pd_pcie);
> +	/* Do nothing when power domain missing */
> +	if (!imx6_pcie->pd_pcie)
> +		return 0;

As I said in the mail that proposed this patch for testing: I think it
would be better to change dev_pm_domain_attach_by_name to not return an
error indication by returning NULL or an ERR_PTR value. (Or change
device_link_add to accept NULL if NULL is a dummy value.)

Just repeating it here to have it near the actual patch.

Best regards
Uwe

>  	link = device_link_add(dev, imx6_pcie->pd_pcie,
>  			DL_FLAG_STATELESS |
>  			DL_FLAG_PM_RUNTIME |
>  			DL_FLAG_RPM_ACTIVE);
>  	if (!link) {
> -- 
> 2.17.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

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



[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