Skip to content

Commit

Permalink
ASoC: simple-card: Make u32 DT parameter handling 64-bit proof
Browse files Browse the repository at this point in the history
Passing unsigned int pointers as u32 ponters may be dangerous on 64-bit
system.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
  • Loading branch information
Jyri Sarha authored and Mark Brown committed Jun 21, 2014
1 parent 7171511 commit c7099eb
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions sound/soc/generic/simple-card.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
{
struct device_node *node;
struct clk *clk;
u32 val;
int ret;

/*
Expand Down Expand Up @@ -151,10 +152,8 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
}

dai->sysclk = clk_get_rate(clk);
} else if (of_property_read_bool(np, "system-clock-frequency")) {
of_property_read_u32(np,
"system-clock-frequency",
&dai->sysclk);
} else if (!of_property_read_u32(np, "system-clock-frequency", &val)) {
dai->sysclk = val;
} else {
clk = of_clk_get(node, 0);
if (!IS_ERR(clk))
Expand Down Expand Up @@ -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 simple_dai_props *dai_props = priv->dai_props;
u32 val;
int ret;

/* parsing the card name from DT */
Expand All @@ -325,8 +325,9 @@ static int asoc_simple_card_parse_of(struct device_node *node,
}

/* Factor to mclk, used in hw_params() */
of_property_read_u32(node, "simple-audio-card,mclk-fs",
&priv->mclk_fs);
ret = of_property_read_u32(node, "simple-audio-card,mclk-fs", &val);
if (ret == 0)
priv->mclk_fs = val;

dev_dbg(dev, "New simple-card: %s\n", priv->snd_card.name ?
priv->snd_card.name : "");
Expand Down

0 comments on commit c7099eb

Please sign in to comment.