Re: [PATCH v2 2/3] ASoC: qcom: q6apm-lpass-dais: Add MI2S clock control
From: Mohammad Rafi Shaik
Date: Mon Jun 15 2026 - 06:01:09 EST
On 6/8/2026 5:31 PM, Mark Brown wrote:
On Mon, Jun 08, 2026 at 08:00:10AM +0530, Mohammad Rafi Shaik wrote:Yes right, Thanks for pointing out.
Add support for MI2S clock control within q6apm-lpass DAIs, including
handling of MCLK, BCLK, and ECLK via the DAI .set_sysclk callback.
+static int q6i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int freq, int dir)
+{
+ struct q6apm_lpass_dai_data *dai_data = dev_get_drvdata(dai->dev);
+ struct clk *sysclk;
+ bool *enabled;
Neither sysclk nor enabled are initialised by default...
I will initialize sysclk and enabled to NULL and add an explicit error
return in the default case of the switch statement to handle invalid clock IDs safely.
+ switch (clk_id) {
+ case LPAIF_MI2S_ECLK:
+ sysclk = dai_data->priv[dai->id].eclk;
+ enabled = &dai_data->priv[dai->id].eclk_enabled;
+ break;
+ default:
+ break;
+ }
+
+ if (sysclk) {
...but we just fall through the switch statement if the clock ID is
invalid and use the values.
ack,
will fix this in next version.
+ for_each_child_of_node(dev->of_node, node) {
+ if (IS_ERR(priv->mclk)) {
+ if (PTR_ERR(priv->mclk) == -EPROBE_DEFER)
+ return dev_err_probe(dev, PTR_ERR(priv->mclk),
+ "unable to get mi2s mclk\n");
+ priv->mclk = NULL;
+ }
Do we need to drop any OF references on early return?
Yes, an of_node_put(node) is required before the early return to avoid a reference leak.
I will update the code to use for_each_child_of_node_scoped() to handle the cleanup automatically, or explicitly call of_node_put() before returning.
Thanks & Regards,
Rafi.