Skip to content

Commit

Permalink
ASoC: tas571x: Eliminate redundant dev->of_node NULL check
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kevin Cernekee authored and Mark Brown committed May 6, 2015
1 parent 5676f5c commit 97fceb4
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions sound/soc/codecs/tas571x.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,25 +377,20 @@ 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);
if (!priv)
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) {
Expand Down

0 comments on commit 97fceb4

Please sign in to comment.