aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/codecs/tas571x.c13
1 files 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,
377{ 377{
378 struct tas571x_private *priv; 378 struct tas571x_private *priv;
379 struct device *dev = &client->dev; 379 struct device *dev = &client->dev;
380 const struct of_device_id *of_id;
380 int i, ret; 381 int i, ret;
381 382
382 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 383 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
@@ -384,18 +385,12 @@ static int tas571x_i2c_probe(struct i2c_client *client,
384 return -ENOMEM; 385 return -ENOMEM;
385 i2c_set_clientdata(client, priv); 386 i2c_set_clientdata(client, priv);
386 387
387 if (dev->of_node) { 388 of_id = of_match_device(tas571x_of_match, dev);
388 const struct of_device_id *of_id; 389 if (!of_id) {
389
390 of_id = of_match_device(tas571x_of_match, dev);
391 if (of_id)
392 priv->chip = of_id->data;
393 }
394
395 if (!priv->chip) {
396 dev_err(dev, "Unknown device type\n"); 390 dev_err(dev, "Unknown device type\n");
397 return -EINVAL; 391 return -EINVAL;
398 } 392 }
393 priv->chip = of_id->data;
399 394
400 priv->mclk = devm_clk_get(dev, "mclk"); 395 priv->mclk = devm_clk_get(dev, "mclk");
401 if (IS_ERR(priv->mclk) && PTR_ERR(priv->mclk) != -ENOENT) { 396 if (IS_ERR(priv->mclk) && PTR_ERR(priv->mclk) != -ENOENT) {