All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: stmmac: fix missing pci_disable_device() on error in stmmac_pci_probe()
@ 2022-05-06  9:40 ` Yang Yingliang
  0 siblings, 0 replies; 6+ messages in thread
From: Yang Yingliang @ 2022-05-06  9:40 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, linux-stm32, netdev
  Cc: peppe.cavallaro, alexandre.torgue, davem, edumazet, kuba

Fix the missing pci_disable_device() before return
from stmmac_pci_probe() in the error handling case.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
index fcf17d8a0494..02bddc05a34f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
@@ -194,7 +194,7 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
 			continue;
 		ret = pcim_iomap_regions(pdev, BIT(i), pci_name(pdev));
 		if (ret)
-			return ret;
+			goto err_out_disable_device;
 		break;
 	}
 
@@ -202,7 +202,7 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
 
 	ret = info->setup(pdev, plat);
 	if (ret)
-		return ret;
+		goto err_out_disable_device;
 
 	memset(&res, 0, sizeof(res));
 	res.addr = pcim_iomap_table(pdev)[i];
@@ -219,7 +219,16 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
 	plat->safety_feat_cfg->prtyen = 1;
 	plat->safety_feat_cfg->tmouten = 1;
 
-	return stmmac_dvr_probe(&pdev->dev, plat, &res);
+	ret = stmmac_dvr_probe(&pdev->dev, plat, &res);
+	if (ret)
+		goto err_out_disable_device;
+
+	return 0;
+
+err_out_disable_device:
+	pci_disable_device(pdev);
+
+	return ret;
 }
 
 /**
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] net: stmmac: fix missing pci_disable_device() on error in stmmac_pci_probe()
@ 2022-05-06  9:40 ` Yang Yingliang
  0 siblings, 0 replies; 6+ messages in thread
From: Yang Yingliang @ 2022-05-06  9:40 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, linux-stm32, netdev
  Cc: peppe.cavallaro, alexandre.torgue, davem, edumazet, kuba

Fix the missing pci_disable_device() before return
from stmmac_pci_probe() in the error handling case.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
index fcf17d8a0494..02bddc05a34f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
@@ -194,7 +194,7 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
 			continue;
 		ret = pcim_iomap_regions(pdev, BIT(i), pci_name(pdev));
 		if (ret)
-			return ret;
+			goto err_out_disable_device;
 		break;
 	}
 
@@ -202,7 +202,7 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
 
 	ret = info->setup(pdev, plat);
 	if (ret)
-		return ret;
+		goto err_out_disable_device;
 
 	memset(&res, 0, sizeof(res));
 	res.addr = pcim_iomap_table(pdev)[i];
@@ -219,7 +219,16 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
 	plat->safety_feat_cfg->prtyen = 1;
 	plat->safety_feat_cfg->tmouten = 1;
 
-	return stmmac_dvr_probe(&pdev->dev, plat, &res);
+	ret = stmmac_dvr_probe(&pdev->dev, plat, &res);
+	if (ret)
+		goto err_out_disable_device;
+
+	return 0;
+
+err_out_disable_device:
+	pci_disable_device(pdev);
+
+	return ret;
 }
 
 /**
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] net: stmmac: fix missing pci_disable_device() on error in stmmac_pci_probe()
  2022-05-06  9:40 ` Yang Yingliang
@ 2022-05-09 22:55   ` Jakub Kicinski
  -1 siblings, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2022-05-09 22:55 UTC (permalink / raw)
  To: Yang Yingliang
  Cc: linux-kernel, linux-arm-kernel, linux-stm32, netdev,
	peppe.cavallaro, alexandre.torgue, davem, edumazet

On Fri, 6 May 2022 17:40:39 +0800 Yang Yingliang wrote:
> Fix the missing pci_disable_device() before return
> from stmmac_pci_probe() in the error handling case.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>

Here indeed pcim_enable_device() seems like a better fit.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] net: stmmac: fix missing pci_disable_device() on error in stmmac_pci_probe()
@ 2022-05-09 22:55   ` Jakub Kicinski
  0 siblings, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2022-05-09 22:55 UTC (permalink / raw)
  To: Yang Yingliang
  Cc: linux-kernel, linux-arm-kernel, linux-stm32, netdev,
	peppe.cavallaro, alexandre.torgue, davem, edumazet

On Fri, 6 May 2022 17:40:39 +0800 Yang Yingliang wrote:
> Fix the missing pci_disable_device() before return
> from stmmac_pci_probe() in the error handling case.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>

Here indeed pcim_enable_device() seems like a better fit.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] net: stmmac: fix missing pci_disable_device() on error in stmmac_pci_probe()
  2022-05-09 22:55   ` Jakub Kicinski
@ 2022-05-10  1:15     ` Yang Yingliang
  -1 siblings, 0 replies; 6+ messages in thread
From: Yang Yingliang @ 2022-05-10  1:15 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: linux-kernel, linux-arm-kernel, linux-stm32, netdev,
	peppe.cavallaro, alexandre.torgue, davem, edumazet

Hi,

On 2022/5/10 6:55, Jakub Kicinski wrote:
> On Fri, 6 May 2022 17:40:39 +0800 Yang Yingliang wrote:
>> Fix the missing pci_disable_device() before return
>> from stmmac_pci_probe() in the error handling case.
>>
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> Here indeed pcim_enable_device() seems like a better fit.
OK, I will send a v2 later.

Thanks,
Yang
> .

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] net: stmmac: fix missing pci_disable_device() on error in stmmac_pci_probe()
@ 2022-05-10  1:15     ` Yang Yingliang
  0 siblings, 0 replies; 6+ messages in thread
From: Yang Yingliang @ 2022-05-10  1:15 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: linux-kernel, linux-arm-kernel, linux-stm32, netdev,
	peppe.cavallaro, alexandre.torgue, davem, edumazet

Hi,

On 2022/5/10 6:55, Jakub Kicinski wrote:
> On Fri, 6 May 2022 17:40:39 +0800 Yang Yingliang wrote:
>> Fix the missing pci_disable_device() before return
>> from stmmac_pci_probe() in the error handling case.
>>
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> Here indeed pcim_enable_device() seems like a better fit.
OK, I will send a v2 later.

Thanks,
Yang
> .

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-05-10  1:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-06  9:40 [PATCH] net: stmmac: fix missing pci_disable_device() on error in stmmac_pci_probe() Yang Yingliang
2022-05-06  9:40 ` Yang Yingliang
2022-05-09 22:55 ` Jakub Kicinski
2022-05-09 22:55   ` Jakub Kicinski
2022-05-10  1:15   ` Yang Yingliang
2022-05-10  1:15     ` Yang Yingliang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.