Skip to content

Commit

Permalink
stmmac: dwmac-loongson: fix invalid mdio_node
Browse files Browse the repository at this point in the history
[ Upstream commit 2ae3411 ]

In current code "plat->mdio_node" is always NULL, the mdio
support is lost as there is no "mdio_bus_data". The original
driver could work as the "mdio" variable is never set to
false, which is described in commit <b0e03950dd71> ("stmmac:
dwmac-loongson: fix uninitialized variable ......"). And
after this commit merged, the "mdio" variable is always
false, causing the mdio supoort logic lost.

Fixes: 30bba69 ("stmmac: pci: Add dwmac support for Loongson")
Signed-off-by: Liu Peibao <liupeibao@loongson.cn>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20221101060218.16453-1-liupeibao@loongson.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Liu Peibao authored and gregkh committed Nov 10, 2022
1 parent 535b787 commit de88977
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id
struct stmmac_resources res;
struct device_node *np;
int ret, i, phy_mode;
bool mdio = false;

np = dev_of_node(&pdev->dev);

Expand All @@ -69,12 +68,10 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id
if (!plat)
return -ENOMEM;

plat->mdio_node = of_get_child_by_name(np, "mdio");
if (plat->mdio_node) {
dev_err(&pdev->dev, "Found MDIO subnode\n");
mdio = true;
}
dev_info(&pdev->dev, "Found MDIO subnode\n");

if (mdio) {
plat->mdio_bus_data = devm_kzalloc(&pdev->dev,
sizeof(*plat->mdio_bus_data),
GFP_KERNEL);
Expand Down

0 comments on commit de88977

Please sign in to comment.