Unverified Commit 044c1140 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Mark Brown
Browse files

ASoC: wm8962: Convert to devm_clk_get_optional()



Use the existing devm_clk_get_optional() helper instead of building a
similar construct on top of devm_clk_get() that fails to handle all
errors but -EPROBE_DEFER.

Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Acked-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/c2a8a1a628804a4439732d02847e25c227083690.1634565564.git.geert+renesas@glider.be


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 3e701151
Loading
Loading
Loading
Loading
+2 −11
Original line number Original line Diff line number Diff line
@@ -3538,9 +3538,8 @@ static int wm8962_set_pdata_from_of(struct i2c_client *i2c,
				pdata->gpio_init[i] = 0x0;
				pdata->gpio_init[i] = 0x0;
		}
		}


	pdata->mclk = devm_clk_get(&i2c->dev, NULL);
	pdata->mclk = devm_clk_get_optional(&i2c->dev, NULL);

	return PTR_ERR_OR_ZERO(pdata->mclk);
	return 0;
}
}


static int wm8962_i2c_probe(struct i2c_client *i2c,
static int wm8962_i2c_probe(struct i2c_client *i2c,
@@ -3572,14 +3571,6 @@ static int wm8962_i2c_probe(struct i2c_client *i2c,
			return ret;
			return ret;
	}
	}


	/* Mark the mclk pointer to NULL if no mclk assigned */
	if (IS_ERR(wm8962->pdata.mclk)) {
		/* But do not ignore the request for probe defer */
		if (PTR_ERR(wm8962->pdata.mclk) == -EPROBE_DEFER)
			return -EPROBE_DEFER;
		wm8962->pdata.mclk = NULL;
	}

	for (i = 0; i < ARRAY_SIZE(wm8962->supplies); i++)
	for (i = 0; i < ARRAY_SIZE(wm8962->supplies); i++)
		wm8962->supplies[i].supply = wm8962_supply_names[i];
		wm8962->supplies[i].supply = wm8962_supply_names[i];