提交 22407e13 编写于 作者: G Giuseppe CAVALLARO 提交者: David S. Miller

stmmac: dwmac-sti: fix st,tx-retime-src check

In case of the st,tx-retime-src is missing from device-tree
(it's an optional field) the driver will invoke the strcasecmp to check
which clock has been selected and this is a bug; the else condition
is needed.

In the dwmac_setup, the "rs" variable, passed to the strcasecmp, was not
initialized and the compiler, depending on the options adopted, could
take it in some different part of the stack generating the hang in such
configuration.
Signed-off-by: NGiuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 61adcc03
...@@ -299,16 +299,17 @@ static int sti_dwmac_parse_data(struct sti_dwmac *dwmac, ...@@ -299,16 +299,17 @@ 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; } else {
} else if (!strcasecmp(rs, "clk_125")) { 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;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册