mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kevin Cernekee <cernekee@chromium.org>
To: lgirdwood@gmail.com, broonie@kernel.org
Cc: lars@metafoo.de, dgreid@chromium.org, abrestic@chromium.org,
	olofj@chromium.org, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] ASoC: tas571x: Eliminate redundant dev->of_node NULL check
Date: Tue,  5 May 2015 15:52:29 -0700	[thread overview]
Message-ID: <1430866350-21391-1-git-send-email-cernekee@chromium.org> (raw)

of_match_device() checks if dev->of_node is NULL, so we don't need to do
it again in the probe function.

Signed-off-by: Kevin Cernekee <cernekee@chromium.org>
---


This applies to the broonie/sound.git for-next branch.


 sound/soc/codecs/tas571x.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/sound/soc/codecs/tas571x.c b/sound/soc/codecs/tas571x.c
index b187ea53a7f9..85bcc374c8e8 100644
--- a/sound/soc/codecs/tas571x.c
+++ b/sound/soc/codecs/tas571x.c
@@ -377,6 +377,7 @@ static int tas571x_i2c_probe(struct i2c_client *client,
 {
 	struct tas571x_private *priv;
 	struct device *dev = &client->dev;
+	const struct of_device_id *of_id;
 	int i, ret;
 
 	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
@@ -384,18 +385,12 @@ static int tas571x_i2c_probe(struct i2c_client *client,
 		return -ENOMEM;
 	i2c_set_clientdata(client, priv);
 
-	if (dev->of_node) {
-		const struct of_device_id *of_id;
-
-		of_id = of_match_device(tas571x_of_match, dev);
-		if (of_id)
-			priv->chip = of_id->data;
-	}
-
-	if (!priv->chip) {
+	of_id = of_match_device(tas571x_of_match, dev);
+	if (!of_id) {
 		dev_err(dev, "Unknown device type\n");
 		return -EINVAL;
 	}
+	priv->chip = of_id->data;
 
 	priv->mclk = devm_clk_get(dev, "mclk");
 	if (IS_ERR(priv->mclk) && PTR_ERR(priv->mclk) != -ENOENT) {
-- 
2.2.0.rc0.207.ga3a616c


             reply	other threads:[~2015-05-05 22:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-05 22:52 Kevin Cernekee [this message]
2015-05-06 10:37 ` 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=1430866350-21391-1-git-send-email-cernekee@chromium.org \
    --to=cernekee@chromium.org \
    --cc=abrestic@chromium.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=dgreid@chromium.org \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olofj@chromium.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®