All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jyri Sarha <jsarha@ti.com>
To: alsa-devel@alsa-project.org, linux-omap@vger.kernel.org,
	devicetree@vger.kernel.org
Cc: bcousson@baylibre.com, peter.ujfalusi@ti.com, broonie@kernel.org,
	liam.r.girdwood@linux.intel.com, detheridge@ti.com,
	Jyri Sarha <jsarha@ti.com>
Subject: [PATCH 1/3] ASoC: simple-card: Make u32 DT parameter handling 64-bit proof
Date: Fri, 13 Jun 2014 13:04:36 +0300	[thread overview]
Message-ID: <ff985604371ff8afa35352db9d460b08760003e2.1402653217.git.jsarha@ti.com> (raw)
In-Reply-To: <cover.1402653217.git.jsarha@ti.com>

Passing unsigned int pointers as u32 ponters may be dangerous on 64-bit
system.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
 sound/soc/generic/simple-card.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 03a7fdc..159e517f 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -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;
 
 	/*
@@ -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))
@@ -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 */
@@ -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 : "");
-- 
1.7.9.5


  reply	other threads:[~2014-06-13 10:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-13 10:04 [PATCH 0/3] More simple-card dai node clock parameters Jyri Sarha
2014-06-13 10:04 ` Jyri Sarha [this message]
2014-06-21 10:07   ` [PATCH 1/3] ASoC: simple-card: Make u32 DT parameter handling 64-bit proof Mark Brown
2014-06-13 10:04 ` [PATCH 2/3] ASoC: simple-card: Add system-clock-direction DT parameter to dai nodes Jyri Sarha
2014-06-13 10:04 ` [PATCH 3/3] ASoC: simple-card: Add system-clock-id " Jyri Sarha
2014-06-13 12:24   ` satish kumar
2014-06-21 10:09   ` Mark Brown
2014-06-24  9:59     ` Jyri Sarha
2014-06-24 10:20       ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ff985604371ff8afa35352db9d460b08760003e2.1402653217.git.jsarha@ti.com \
    --to=jsarha@ti.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=bcousson@baylibre.com \
    --cc=broonie@kernel.org \
    --cc=detheridge@ti.com \
    --cc=devicetree@vger.kernel.org \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=peter.ujfalusi@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.