Skip to content

Commit bb737ec

Browse files
YueHaibinggregkh
authored andcommitted
stmmac: platform: Fix signedness bug in stmmac_probe_config_dt()
[ Upstream commit eca81f0 ] The "plat->phy_interface" variable is an enum and in this context GCC will treat it as an unsigned int so the error handling is never triggered. Fixes: b9f0b2f ("net: stmmac: platform: fix probe for ACPI devices") Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 79ec7b5 commit bb737ec

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
399399
struct device_node *np = pdev->dev.of_node;
400400
struct plat_stmmacenet_data *plat;
401401
struct stmmac_dma_cfg *dma_cfg;
402+
int phy_mode;
402403
int rc;
403404

404405
plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL);
@@ -413,10 +414,11 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
413414
*mac = NULL;
414415
}
415416

416-
plat->phy_interface = device_get_phy_mode(&pdev->dev);
417-
if (plat->phy_interface < 0)
418-
return ERR_PTR(plat->phy_interface);
417+
phy_mode = device_get_phy_mode(&pdev->dev);
418+
if (phy_mode < 0)
419+
return ERR_PTR(phy_mode);
419420

421+
plat->phy_interface = phy_mode;
420422
plat->interface = stmmac_of_get_mac_mode(np);
421423
if (plat->interface < 0)
422424
plat->interface = plat->phy_interface;

0 commit comments

Comments
 (0)