netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] r8169: check for PCI read error in probe
@ 2023-05-28 17:35 Heiner Kallweit
  2023-05-30  7:40 ` Simon Horman
  2023-05-30 11:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Heiner Kallweit @ 2023-05-28 17:35 UTC (permalink / raw)
  To: Jakub Kicinski, David Miller, Realtek linux nic maintainers,
	Eric Dumazet, Paolo Abeni
  Cc: netdev@vger.kernel.org

Check whether first PCI read returns 0xffffffff. Currently, if this is
the case, the user sees the following misleading message:
unknown chip XID fcf, contact r8169 maintainers (see MAINTAINERS file)

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/ethernet/realtek/r8169_main.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index 4b19803a7..5e6308d57 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -5164,6 +5164,7 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	int jumbo_max, region, rc;
 	enum mac_version chipset;
 	struct net_device *dev;
+	u32 txconfig;
 	u16 xid;
 
 	dev = devm_alloc_etherdev(&pdev->dev, sizeof (*tp));
@@ -5218,7 +5219,13 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	tp->mmio_addr = pcim_iomap_table(pdev)[region];
 
-	xid = (RTL_R32(tp, TxConfig) >> 20) & 0xfcf;
+	txconfig = RTL_R32(tp, TxConfig);
+	if (txconfig == ~0U) {
+		dev_err(&pdev->dev, "PCI read failed\n");
+		return -EIO;
+	}
+
+	xid = (txconfig >> 20) & 0xfcf;
 
 	/* Identify chip attached to board */
 	chipset = rtl8169_get_mac_version(xid, tp->supports_gmii);
-- 
2.40.1


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

* Re: [PATCH net-next] r8169: check for PCI read error in probe
  2023-05-28 17:35 [PATCH net-next] r8169: check for PCI read error in probe Heiner Kallweit
@ 2023-05-30  7:40 ` Simon Horman
  2023-05-30 11:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2023-05-30  7:40 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Jakub Kicinski, David Miller, Realtek linux nic maintainers,
	Eric Dumazet, Paolo Abeni, netdev@vger.kernel.org

On Sun, May 28, 2023 at 07:35:12PM +0200, Heiner Kallweit wrote:
> Check whether first PCI read returns 0xffffffff. Currently, if this is
> the case, the user sees the following misleading message:
> unknown chip XID fcf, contact r8169 maintainers (see MAINTAINERS file)
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Reviewed-by: Simon Horman <simon.horman@corigine.com>


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

* Re: [PATCH net-next] r8169: check for PCI read error in probe
  2023-05-28 17:35 [PATCH net-next] r8169: check for PCI read error in probe Heiner Kallweit
  2023-05-30  7:40 ` Simon Horman
@ 2023-05-30 11:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-05-30 11:20 UTC (permalink / raw)
  To: Heiner Kallweit; +Cc: kuba, davem, nic_swsd, edumazet, pabeni, netdev

Hello:

This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Sun, 28 May 2023 19:35:12 +0200 you wrote:
> Check whether first PCI read returns 0xffffffff. Currently, if this is
> the case, the user sees the following misleading message:
> unknown chip XID fcf, contact r8169 maintainers (see MAINTAINERS file)
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  drivers/net/ethernet/realtek/r8169_main.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)

Here is the summary with links:
  - [net-next] r8169: check for PCI read error in probe
    https://git.kernel.org/netdev/net-next/c/bc590b475492

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] 3+ messages in thread

end of thread, other threads:[~2023-05-30 11:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-28 17:35 [PATCH net-next] r8169: check for PCI read error in probe Heiner Kallweit
2023-05-30  7:40 ` Simon Horman
2023-05-30 11:20 ` 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).