mirror of
https://github.com/torvalds/linux.git
synced 2024-12-18 09:02:17 +00:00
net: stmmac: sti: Fix uninitialized pointer dereference if !OF
If CONFIG_OF is not set: drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c: In function ‘sti_dwmac_parse_data’: drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c:318: warning: ‘rs’ is used uninitialized in this function of_property_read_string() will return -ENOSYS in this case, and rs will be an uninitialized pointer. While the fallback clock selection is already selected correctly in this case, the string comparisons should be skipped too, else the system will crash while dereferencing the uninitialized pointer. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
372a07302f
commit
50262c8533
@ -309,16 +309,16 @@ static int sti_dwmac_parse_data(struct sti_dwmac *dwmac,
|
|||||||
|
|
||||||
if (IS_PHY_IF_MODE_GBIT(dwmac->interface)) {
|
if (IS_PHY_IF_MODE_GBIT(dwmac->interface)) {
|
||||||
const char *rs;
|
const char *rs;
|
||||||
dwmac->tx_retime_src = TX_RETIME_SRC_CLKGEN;
|
|
||||||
|
|
||||||
err = of_property_read_string(np, "st,tx-retime-src", &rs);
|
err = of_property_read_string(np, "st,tx-retime-src", &rs);
|
||||||
if (err < 0)
|
if (err < 0) {
|
||||||
dev_warn(dev, "Use internal clock source\n");
|
dev_warn(dev, "Use internal clock source\n");
|
||||||
|
dwmac->tx_retime_src = TX_RETIME_SRC_CLKGEN;
|
||||||
if (!strcasecmp(rs, "clk_125"))
|
} else if (!strcasecmp(rs, "clk_125")) {
|
||||||
dwmac->tx_retime_src = TX_RETIME_SRC_CLK_125;
|
dwmac->tx_retime_src = TX_RETIME_SRC_CLK_125;
|
||||||
else if (!strcasecmp(rs, "txclk"))
|
} else if (!strcasecmp(rs, "txclk")) {
|
||||||
dwmac->tx_retime_src = TX_RETIME_SRC_TXCLK;
|
dwmac->tx_retime_src = TX_RETIME_SRC_TXCLK;
|
||||||
|
}
|
||||||
|
|
||||||
dwmac->speed = SPEED_1000;
|
dwmac->speed = SPEED_1000;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user