* [PATCH] ethernet: tulip: fix missing pci_disable_device() on error in tulip_init_one()
@ 2022-05-06 9:42 Yang Yingliang
2022-05-06 10:11 ` Rolf Eike Beer
2022-05-09 23:10 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 5+ messages in thread
From: Yang Yingliang @ 2022-05-06 9:42 UTC (permalink / raw)
To: linux-kernel, linux-parisc, netdev; +Cc: davem, edumazet, kuba
Fix the missing pci_disable_device() before return
from tulip_init_one() in the error handling case.
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
drivers/net/ethernet/dec/tulip/tulip_core.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/dec/tulip/tulip_core.c b/drivers/net/ethernet/dec/tulip/tulip_core.c
index 79df5a72877b..0040dcaab945 100644
--- a/drivers/net/ethernet/dec/tulip/tulip_core.c
+++ b/drivers/net/ethernet/dec/tulip/tulip_core.c
@@ -1399,8 +1399,10 @@ static int tulip_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
/* alloc_etherdev ensures aligned and zeroed private structures */
dev = alloc_etherdev (sizeof (*tp));
- if (!dev)
+ if (!dev) {
+ pci_disable_device(pdev);
return -ENOMEM;
+ }
SET_NETDEV_DEV(dev, &pdev->dev);
if (pci_resource_len (pdev, 0) < tulip_tbl[chip_idx].io_size) {
@@ -1785,6 +1787,7 @@ static int tulip_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
err_out_free_netdev:
free_netdev (dev);
+ pci_disable_device(pdev);
return -ENODEV;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] ethernet: tulip: fix missing pci_disable_device() on error in tulip_init_one()
2022-05-06 9:42 [PATCH] ethernet: tulip: fix missing pci_disable_device() on error in tulip_init_one() Yang Yingliang
@ 2022-05-06 10:11 ` Rolf Eike Beer
2022-05-06 16:21 ` Jakub Kicinski
2022-05-09 23:10 ` patchwork-bot+netdevbpf
1 sibling, 1 reply; 5+ messages in thread
From: Rolf Eike Beer @ 2022-05-06 10:11 UTC (permalink / raw)
To: linux-kernel, linux-parisc, netdev, Yang Yingliang; +Cc: davem, edumazet, kuba
[-- Attachment #1: Type: text/plain, Size: 459 bytes --]
Am Freitag, 6. Mai 2022, 11:42:50 CEST schrieb Yang Yingliang:
> Fix the missing pci_disable_device() before return
> from tulip_init_one() in the error handling case.
I would suggest removing the pci_disable_device() from tulip_remove_one()
instead and using pcim_enable_device(), i.e. devres, and let the driver core
handle all these things. Of course more of the used functions could be
converted them, e.g. using devm_alloc_etherdev() and so on.
Eike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ethernet: tulip: fix missing pci_disable_device() on error in tulip_init_one()
2022-05-06 10:11 ` Rolf Eike Beer
@ 2022-05-06 16:21 ` Jakub Kicinski
2022-05-11 21:55 ` Rolf Eike Beer
0 siblings, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2022-05-06 16:21 UTC (permalink / raw)
To: Rolf Eike Beer
Cc: linux-kernel, linux-parisc, netdev, Yang Yingliang, davem, edumazet
On Fri, 06 May 2022 12:11:56 +0200 Rolf Eike Beer wrote:
> Am Freitag, 6. Mai 2022, 11:42:50 CEST schrieb Yang Yingliang:
> > Fix the missing pci_disable_device() before return
> > from tulip_init_one() in the error handling case.
>
> I would suggest removing the pci_disable_device() from tulip_remove_one()
> instead and using pcim_enable_device(), i.e. devres, and let the driver core
> handle all these things. Of course more of the used functions could be
> converted them, e.g. using devm_alloc_etherdev() and so on.
Let's not rewrite the error handling in this dinosaur of a driver
any more than absolutely necessary, please.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ethernet: tulip: fix missing pci_disable_device() on error in tulip_init_one()
2022-05-06 9:42 [PATCH] ethernet: tulip: fix missing pci_disable_device() on error in tulip_init_one() Yang Yingliang
2022-05-06 10:11 ` Rolf Eike Beer
@ 2022-05-09 23:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-05-09 23:10 UTC (permalink / raw)
To: Yang Yingliang; +Cc: linux-kernel, linux-parisc, netdev, davem, edumazet, kuba
Hello:
This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Fri, 6 May 2022 17:42:50 +0800 you wrote:
> Fix the missing pci_disable_device() before return
> from tulip_init_one() in the error handling case.
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
> drivers/net/ethernet/dec/tulip/tulip_core.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
Here is the summary with links:
- ethernet: tulip: fix missing pci_disable_device() on error in tulip_init_one()
https://git.kernel.org/netdev/net/c/51ca86b4c9c7
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ethernet: tulip: fix missing pci_disable_device() on error in tulip_init_one()
2022-05-06 16:21 ` Jakub Kicinski
@ 2022-05-11 21:55 ` Rolf Eike Beer
0 siblings, 0 replies; 5+ messages in thread
From: Rolf Eike Beer @ 2022-05-11 21:55 UTC (permalink / raw)
To: Jakub Kicinski
Cc: linux-kernel, linux-parisc, netdev, Yang Yingliang, davem, edumazet
[-- Attachment #1: Type: text/plain, Size: 1114 bytes --]
Am Freitag, 6. Mai 2022, 18:21:52 CEST schrieb Jakub Kicinski:
> On Fri, 06 May 2022 12:11:56 +0200 Rolf Eike Beer wrote:
> > Am Freitag, 6. Mai 2022, 11:42:50 CEST schrieb Yang Yingliang:
> > > Fix the missing pci_disable_device() before return
> > > from tulip_init_one() in the error handling case.
> >
> > I would suggest removing the pci_disable_device() from tulip_remove_one()
> > instead and using pcim_enable_device(), i.e. devres, and let the driver
> > core handle all these things. Of course more of the used functions could
> > be converted them, e.g. using devm_alloc_etherdev() and so on.
>
> Let's not rewrite the error handling in this dinosaur of a driver
> any more than absolutely necessary, please.
Challenge accepted ;)
[ 274.452394] tulip0: no phy info, aborting mtable build
[ 274.499041] tulip0: MII transceiver #1 config 1000 status 782d advertising 01e1
[ 274.750691] net eth0: Digital DS21142/43 Tulip rev 65 at MMIO 0xf4008000, 00:30:6e:08:7d:21, IRQ 17
[ 283.104520] net eth0: Setting full-duplex based on MII#1 link partner capability of c1e1
Works fine, patch in a minute.
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-05-11 21:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-06 9:42 [PATCH] ethernet: tulip: fix missing pci_disable_device() on error in tulip_init_one() Yang Yingliang
2022-05-06 10:11 ` Rolf Eike Beer
2022-05-06 16:21 ` Jakub Kicinski
2022-05-11 21:55 ` Rolf Eike Beer
2022-05-09 23:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).