Commit 28603d13 authored by Huacai Chen's avatar Huacai Chen Committed by David S. Miller

stmmac: platform: Move plat_dat checking earlier

Original code only check/alloc plat_dat for the CONFIG_OF case, this
patch check/alloc it earlier and unconditionally to avoid kernel build
warnings:

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:275
stmmac_pltfr_probe() warn: variable dereferenced before check 'plat_dat'

V2: Fix coding style.
Signed-off-by: default avatarHuacai Chen <chenhc@lemote.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4d6a949c
...@@ -265,13 +265,6 @@ static int stmmac_pltfr_probe(struct platform_device *pdev) ...@@ -265,13 +265,6 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
plat_dat = dev_get_platdata(&pdev->dev); plat_dat = dev_get_platdata(&pdev->dev);
/* Set default value for multicast hash bins */
plat_dat->multicast_filter_bins = HASH_TABLE_SIZE;
/* Set default value for unicast filter entries */
plat_dat->unicast_filter_entries = 1;
if (pdev->dev.of_node) {
if (!plat_dat) if (!plat_dat)
plat_dat = devm_kzalloc(&pdev->dev, plat_dat = devm_kzalloc(&pdev->dev,
sizeof(struct plat_stmmacenet_data), sizeof(struct plat_stmmacenet_data),
...@@ -281,6 +274,13 @@ static int stmmac_pltfr_probe(struct platform_device *pdev) ...@@ -281,6 +274,13 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
} }
/* Set default value for multicast hash bins */
plat_dat->multicast_filter_bins = HASH_TABLE_SIZE;
/* Set default value for unicast filter entries */
plat_dat->unicast_filter_entries = 1;
if (pdev->dev.of_node) {
ret = stmmac_probe_config_dt(pdev, plat_dat, &mac); ret = stmmac_probe_config_dt(pdev, plat_dat, &mac);
if (ret) { if (ret) {
pr_err("%s: main dt probe failed", __func__); pr_err("%s: main dt probe failed", __func__);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment