[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231018190229.1880170-1-radu-nicolae.pirea@oss.nxp.com>
Date: Wed, 18 Oct 2023 22:02:29 +0300
From: "Radu Pirea (NXP OSS)" <radu-nicolae.pirea@....nxp.com>
To: wei.fang@....com,
shenwei.wang@....com,
xiaoning.wang@....com,
davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
robh@...nel.org
Cc: sebastian.tobuschat@....nxp.com,
linux-imx@....com,
netdev@...r.kernel.org,
"Radu Pirea (NXP OSS)" <radu-nicolae.pirea@....nxp.com>
Subject: [PATCH net-next] net: fec: fix dev_info pointer
of_match_table.data contains pointers to struct platform_device_id, not
struct fec_devinfo. A pointer to a fec_devinfo structure is stored in
platform_device_id->driver_data.
This BUG makes the driver connect to a Generic PHY.
Discovered on Freescale i.MX6 Quad SABRE Automotive Board.
Fixes: b0377116decd ("net: ethernet: Use device_get_match_data()")
Signed-off-by: Radu Pirea (NXP OSS) <radu-nicolae.pirea@....nxp.com>
---
drivers/net/ethernet/freescale/fec_main.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 5eb756871a96..b0decae956e7 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -4285,6 +4285,7 @@ static int fec_enet_init_stop_mode(struct fec_enet_private *fep,
static int
fec_probe(struct platform_device *pdev)
{
+ const struct platform_device_id *pd_id;
struct fec_enet_private *fep;
struct fec_platform_data *pdata;
phy_interface_t interface;
@@ -4311,9 +4312,10 @@ fec_probe(struct platform_device *pdev)
/* setup board info structure */
fep = netdev_priv(ndev);
- dev_info = device_get_match_data(&pdev->dev);
- if (!dev_info)
- dev_info = (const struct fec_devinfo *)pdev->id_entry->driver_data;
+ pd_id = device_get_match_data(&pdev->dev);
+ if (pd_id)
+ pdev->id_entry = pd_id;
+ dev_info = (const struct fec_devinfo *)pdev->id_entry->driver_data;
if (dev_info)
fep->quirks = dev_info->quirks;
--
2.34.1
Powered by blists - more mailing lists