From: phucduc.bui@gmail.com
To: Maxim Kochetkov <fido_max@inbox.ru>,
Andrew Jackson <Andrew.Jackson@arm.com>,
Mark Brown <broonie@kernel.org>,
Xingyu Wu <xingyu.wu@starfivetech.com>
Cc: Tim Bird <tim.bird@sony.com>,
Yuri Zaporozhets <yuriz@vodafonemail.de>,
Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
bui duc phuc <phucduc.bui@gmail.com>
Subject: [PATCH v3 2/6] ASoC: dwc: Fix error handling in dw_i2s_set_fmt()
Date: Wed, 11 Nov 2026 09:27:27 +0700 [thread overview]
Message-ID: <20261111022731.8243-3-phucduc.bui@gmail.com> (raw)
In-Reply-To: <20261111022731.8243-1-phucduc.bui@gmail.com>
From: bui duc phuc <phucduc.bui@gmail.com>
Return early when an unsupported clock provider format is
encountered, preventing the function from updating frame_offset
before returning an error.
Fixes: 221acc16aee1 ("ASoC: dwc: Add TDM mode support")
Reviewed-by: Maxim Kochetkov <fido_max@inbox.ru>
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
Changes in v2:
- Move the typo fixes into a separate commit.
- Add Maxim Kochetkov's Reviewed-by tag.
sound/soc/dwc/dwc-i2s.c | 22 ++++++----------------
1 file changed, 6 insertions(+), 16 deletions(-)
diff --git a/sound/soc/dwc/dwc-i2s.c b/sound/soc/dwc/dwc-i2s.c
index 1f4d06a82333..6a25d2a69ea7 100644
--- a/sound/soc/dwc/dwc-i2s.c
+++ b/sound/soc/dwc/dwc-i2s.c
@@ -390,29 +390,19 @@ static int dw_i2s_trigger(struct snd_pcm_substream *substream,
static int dw_i2s_set_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
{
struct dw_i2s_dev *dev = snd_soc_dai_get_drvdata(cpu_dai);
- int ret = 0;
switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
case SND_SOC_DAIFMT_BC_FC:
- if (dev->capability & DW_I2S_SLAVE)
- ret = 0;
- else
- ret = -EINVAL;
+ if (!(dev->capability & DW_I2S_SLAVE))
+ return -EINVAL;
break;
case SND_SOC_DAIFMT_BP_FP:
- if (dev->capability & DW_I2S_MASTER)
- ret = 0;
- else
- ret = -EINVAL;
- break;
- case SND_SOC_DAIFMT_BC_FP:
- case SND_SOC_DAIFMT_BP_FC:
- ret = -EINVAL;
+ if (!(dev->capability & DW_I2S_MASTER))
+ return -EINVAL;
break;
default:
dev_dbg(dev->dev, "dwc : Invalid clock provider format\n");
- ret = -EINVAL;
- break;
+ return -EINVAL;
}
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
@@ -431,7 +421,7 @@ static int dw_i2s_set_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
return -EINVAL;
}
- return ret;
+ return 0;
}
static int dw_i2s_set_tdm_slot(struct snd_soc_dai *cpu_dai, unsigned int tx_mask,
--
2.43.0
next prev parent reply other threads:[~2026-11-11 2:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 2:27 [PATCH v3 0/6] ASoC: dwc: Fix several issues in the I2S driver phucduc.bui
2026-11-11 2:27 ` [PATCH v3 1/6] ASoC: dwc: Fix bit clock rate in TDM mode phucduc.bui
2026-11-11 2:27 ` phucduc.bui [this message]
2026-11-11 2:27 ` [PATCH v3 3/6] ASoC: dwc: Fix channels_max derived from COMP_PARAM_1 phucduc.bui
2026-11-11 2:27 ` [PATCH v3 4/6] ASoC: dwc: Fix DMA fifo_size calculation phucduc.bui
2026-11-11 2:27 ` [PATCH v3 5/6] ASoC: dwc: Propagate optional IRQ lookup errors phucduc.bui
2026-11-11 2:27 ` [PATCH v3 6/6] ASoC: dwc: Remove redundant error messages phucduc.bui
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261111022731.8243-3-phucduc.bui@gmail.com \
--to=phucduc.bui@gmail.com \
--cc=Andrew.Jackson@arm.com \
--cc=broonie@kernel.org \
--cc=fido_max@inbox.ru \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tim.bird@sony.com \
--cc=tiwai@suse.com \
--cc=xingyu.wu@starfivetech.com \
--cc=yuriz@vodafonemail.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.