ASoC: tas571x: Eliminate redundant dev->of_node NULL check
authorKevin Cernekee <cernekee@chromium.org>
Tue, 5 May 2015 22:52:29 +0000 (15:52 -0700)
committerMark Brown <broonie@kernel.org>
Wed, 6 May 2015 10:37:33 +0000 (11:37 +0100)
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>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/tas571x.c

index b187ea53a7f98560a7776b7af31da79afac307d4..85bcc374c8e8e34e99f008d0f542deebbdab9e49 100644 (file)
@@ -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) {