[PATCH] pci: pci-tegra: fix null pointer assignation.

Lucas Stach l.stach at pengutronix.de
Thu Nov 27 01:19:34 PST 2025


Hi,

Am Mittwoch, dem 26.11.2025 um 22:40 -0500 schrieb
chalianis1 at gmail.com:
> From: Chali Anis <chalianis1 at gmail.com>
> 
> the dev might be null, to be sure we move the dev assignation before
> the pci parent assignation.

This isn't worded strongly enough. pcie->dev will absolutely be NULL at
the point where it is assigned to pci.parent, which seem like a blatant
bug and I don't know how this did ever work or if we just ignored the
broken parent device connection.

Other than the commit message needing some adjustment, this change
looks correct.

Regards,
Lucas

> 
> Signed-off-by: Chali Anis <chalianis1 at gmail.com>
> ---
>  drivers/pci/pci-tegra.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/pci-tegra.c b/drivers/pci/pci-tegra.c
> index b7f8297d153e..dabe63500a4a 100644
> --- a/drivers/pci/pci-tegra.c
> +++ b/drivers/pci/pci-tegra.c
> @@ -1240,13 +1240,13 @@ static int tegra_pcie_probe(struct device *dev)
>  	if (!pcie)
>  		return -ENOMEM;
>  
> +	pcie->dev = dev;
>  	pcie->pci.parent = pcie->dev;
>  	pci_controller_init(&pcie->pci);
>  
>  	INIT_LIST_HEAD(&pcie->buses);
>  	INIT_LIST_HEAD(&pcie->ports);
>  	pcie->soc_data = device_get_match_data(dev);
> -	pcie->dev = dev;
>  
>  	err = tegra_pcie_parse_dt(pcie);
>  	if (err < 0) {
> 




More information about the barebox mailing list