[PATCH 1/2] PCI: dra7xx: Fix link removal on probe error
Luca Ceresoli
luca at lucaceresoli.net
Tue Jan 11 02:35:48 PST 2022
Hi Rob,
On 16/12/21 10:08, Luca Ceresoli wrote:
> Hi Rob,
>
> thanks for the quick feedback!
>
> On 14/12/21 23:42, Rob Herring wrote:
>> On Tue, Dec 14, 2021 at 4:15 PM Luca Ceresoli <luca at lucaceresoli.net> wrote:
>>>
>>> If a devm_phy_get() calls fails with phy_count==N (N > 0), then N links
>>> have already been added by device_link_add() and won't be deleted by
>>> device_link_del() because the code calls 'return' and not 'goto err_link'.
>>>
>>> Fix in a very simple way by doing all the devm_phy_get() calls before all
>>> the device_link_add() calls.
>>>
>>> Fixes: 7a4db656a635 ("PCI: dra7xx: Create functional dependency between PCIe and PHY")
>>> Signed-off-by: Luca Ceresoli <luca at lucaceresoli.net>
>>> ---
>>> drivers/pci/controller/dwc/pci-dra7xx.c | 2 ++
>>> 1 file changed, 2 insertions(+)
>>>
>>> diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c
>>> index f7f1490e7beb..2ccc53869e13 100644
>>> --- a/drivers/pci/controller/dwc/pci-dra7xx.c
>>> +++ b/drivers/pci/controller/dwc/pci-dra7xx.c
>>> @@ -757,7 +757,9 @@ static int dra7xx_pcie_probe(struct platform_device *pdev)
>>> phy[i] = devm_phy_get(dev, name);
>>> if (IS_ERR(phy[i]))
>>> return PTR_ERR(phy[i]);
>>> + }
>>>
>>> + for (i = 0; i < phy_count; i++) {
>>> link[i] = device_link_add(dev, &phy[i]->dev, DL_FLAG_STATELESS);
>>
>> I think this should happen automatically now with fw_devlink being
>> enabled by default. Can you try?
>
> Do you mean removal should be done automatically? I think they are not
> due to the DL_FLAG_STATELESS flag.
I would love to have feedback because, as said, I think my patch is
correct, but if I'm wrong (which might well be) I have to drop patch 1
and rewrite patch 2 in a slightly more complex form.
About your request to try: I only have hardware with phy_count==1, and
anyway I cannot access it at the moment. :(
Regards.
--
Luca
More information about the linux-arm-kernel
mailing list