提交 c7099eb1 编写于 作者: J Jyri Sarha 提交者: Mark Brown

ASoC: simple-card: Make u32 DT parameter handling 64-bit proof

Passing unsigned int pointers as u32 ponters may be dangerous on 64-bit
system.
Signed-off-by: NJyri Sarha <jsarha@ti.com>
Signed-off-by: NMark Brown <broonie@linaro.org>
上级 7171511e
...@@ -116,6 +116,7 @@ asoc_simple_card_sub_parse_of(struct device_node *np, ...@@ -116,6 +116,7 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
{ {
struct device_node *node; struct device_node *node;
struct clk *clk; struct clk *clk;
u32 val;
int ret; int ret;
/* /*
...@@ -151,10 +152,8 @@ asoc_simple_card_sub_parse_of(struct device_node *np, ...@@ -151,10 +152,8 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
} }
dai->sysclk = clk_get_rate(clk); dai->sysclk = clk_get_rate(clk);
} else if (of_property_read_bool(np, "system-clock-frequency")) { } else if (!of_property_read_u32(np, "system-clock-frequency", &val)) {
of_property_read_u32(np, dai->sysclk = val;
"system-clock-frequency",
&dai->sysclk);
} else { } else {
clk = of_clk_get(node, 0); clk = of_clk_get(node, 0);
if (!IS_ERR(clk)) if (!IS_ERR(clk))
...@@ -303,6 +302,7 @@ static int asoc_simple_card_parse_of(struct device_node *node, ...@@ -303,6 +302,7 @@ static int asoc_simple_card_parse_of(struct device_node *node,
{ {
struct snd_soc_dai_link *dai_link = priv->snd_card.dai_link; struct snd_soc_dai_link *dai_link = priv->snd_card.dai_link;
struct simple_dai_props *dai_props = priv->dai_props; struct simple_dai_props *dai_props = priv->dai_props;
u32 val;
int ret; int ret;
/* parsing the card name from DT */ /* parsing the card name from DT */
...@@ -325,8 +325,9 @@ static int asoc_simple_card_parse_of(struct device_node *node, ...@@ -325,8 +325,9 @@ static int asoc_simple_card_parse_of(struct device_node *node,
} }
/* Factor to mclk, used in hw_params() */ /* Factor to mclk, used in hw_params() */
of_property_read_u32(node, "simple-audio-card,mclk-fs", ret = of_property_read_u32(node, "simple-audio-card,mclk-fs", &val);
&priv->mclk_fs); if (ret == 0)
priv->mclk_fs = val;
dev_dbg(dev, "New simple-card: %s\n", priv->snd_card.name ? dev_dbg(dev, "New simple-card: %s\n", priv->snd_card.name ?
priv->snd_card.name : ""); priv->snd_card.name : "");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册