Message ID | 20221116022147.2636355-1-ruanjinjie@huawei.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | PCI: dwc: add missing free_irq() in ks_pcie_remove() and error path in ks_pcie_probe() | expand |
The fix has a problem, I will send v2 soon. On 2022/11/16 10:21, ruanjinjie wrote: > free_irq() is missing in ks_pcie_remove() and some cases of error > in ks_pcie_probe(), fix that. > > Fixes: 49229238ab47 ("PCI: keystone: Cleanup PHY handling") > > Signed-off-by: ruanjinjie <ruanjinjie@huawei.com> > --- > drivers/pci/controller/dwc/pci-keystone.c | 15 +++++++++++---- > 1 file changed, 11 insertions(+), 4 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c > index 78818853af9e..fc854ccaf155 100644 > --- a/drivers/pci/controller/dwc/pci-keystone.c > +++ b/drivers/pci/controller/dwc/pci-keystone.c > @@ -1179,12 +1179,16 @@ static int __init ks_pcie_probe(struct platform_device *pdev) > num_lanes = 1; > > phy = devm_kzalloc(dev, sizeof(*phy) * num_lanes, GFP_KERNEL); > - if (!phy) > - return -ENOMEM; > + if (!phy) { > + ret = -ENOMEM; > + goto free_irq; > + } > > link = devm_kzalloc(dev, sizeof(*link) * num_lanes, GFP_KERNEL); > - if (!link) > - return -ENOMEM; > + if (!link) { > + ret = -ENOMEM; > + goto free_irq; > + } > > for (i = 0; i < num_lanes; i++) { > snprintf(name, sizeof(name), "pcie-phy%d", i); > @@ -1300,6 +1304,8 @@ static int __init ks_pcie_probe(struct platform_device *pdev) > while (--i >= 0 && link[i]) > device_link_del(link[i]); > > +free_irq: > + free_irq(irq, ks_pcie); > return ret; > } > > @@ -1315,6 +1321,7 @@ static int __exit ks_pcie_remove(struct platform_device *pdev) > ks_pcie_disable_phy(ks_pcie); > while (num_lanes--) > device_link_del(link[num_lanes]); > + free_irq(irq, ks_pcie); > > return 0; > }
diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c index 78818853af9e..fc854ccaf155 100644 --- a/drivers/pci/controller/dwc/pci-keystone.c +++ b/drivers/pci/controller/dwc/pci-keystone.c @@ -1179,12 +1179,16 @@ static int __init ks_pcie_probe(struct platform_device *pdev) num_lanes = 1; phy = devm_kzalloc(dev, sizeof(*phy) * num_lanes, GFP_KERNEL); - if (!phy) - return -ENOMEM; + if (!phy) { + ret = -ENOMEM; + goto free_irq; + } link = devm_kzalloc(dev, sizeof(*link) * num_lanes, GFP_KERNEL); - if (!link) - return -ENOMEM; + if (!link) { + ret = -ENOMEM; + goto free_irq; + } for (i = 0; i < num_lanes; i++) { snprintf(name, sizeof(name), "pcie-phy%d", i); @@ -1300,6 +1304,8 @@ static int __init ks_pcie_probe(struct platform_device *pdev) while (--i >= 0 && link[i]) device_link_del(link[i]); +free_irq: + free_irq(irq, ks_pcie); return ret; } @@ -1315,6 +1321,7 @@ static int __exit ks_pcie_remove(struct platform_device *pdev) ks_pcie_disable_phy(ks_pcie); while (num_lanes--) device_link_del(link[num_lanes]); + free_irq(irq, ks_pcie); return 0; }
free_irq() is missing in ks_pcie_remove() and some cases of error in ks_pcie_probe(), fix that. Fixes: 49229238ab47 ("PCI: keystone: Cleanup PHY handling") Signed-off-by: ruanjinjie <ruanjinjie@huawei.com> --- drivers/pci/controller/dwc/pci-keystone.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)