Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 6.11 07/16] ASoC: tas2781: Add new driver version for tas2563 & tas2781 qfn chip
       [not found] <20241112103605.1652910-1-sashal@kernel.org>
@ 2024-11-12 10:35 ` Sasha Levin
  2024-11-12 10:35 ` [PATCH AUTOSEL 6.11 13/16] ASoC: stm: Prevent potential division by zero in stm32_sai_mclk_round_rate() Sasha Levin
  2024-11-12 10:35 ` [PATCH AUTOSEL 6.11 14/16] ASoC: stm: Prevent potential division by zero in stm32_sai_get_clk_div() Sasha Levin
  2 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2024-11-12 10:35 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Shenghao Ding, Mark Brown, Sasha Levin, kevin-lu, baojun.xu,
	lgirdwood, perex, tiwai, alsa-devel, linux-sound

From: Shenghao Ding <shenghao-ding@ti.com>

[ Upstream commit fe09de2db2365eed8b44b572cff7d421eaf1754a ]

Add new driver version to support tas2563 & tas2781 qfn chip

Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
Link: https://patch.msgid.link/20241104100055.48-1-shenghao-ding@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/codecs/tas2781-fmwlib.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/codecs/tas2781-fmwlib.c b/sound/soc/codecs/tas2781-fmwlib.c
index f3a7605f07104..6474cc551d551 100644
--- a/sound/soc/codecs/tas2781-fmwlib.c
+++ b/sound/soc/codecs/tas2781-fmwlib.c
@@ -1992,6 +1992,7 @@ static int tasdevice_dspfw_ready(const struct firmware *fmw,
 		break;
 	case 0x202:
 	case 0x400:
+	case 0x401:
 		tas_priv->fw_parse_variable_header =
 			fw_parse_variable_header_git;
 		tas_priv->fw_parse_program_data =
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH AUTOSEL 6.11 13/16] ASoC: stm: Prevent potential division by zero in stm32_sai_mclk_round_rate()
       [not found] <20241112103605.1652910-1-sashal@kernel.org>
  2024-11-12 10:35 ` [PATCH AUTOSEL 6.11 07/16] ASoC: tas2781: Add new driver version for tas2563 & tas2781 qfn chip Sasha Levin
@ 2024-11-12 10:35 ` Sasha Levin
  2024-11-12 10:35 ` [PATCH AUTOSEL 6.11 14/16] ASoC: stm: Prevent potential division by zero in stm32_sai_get_clk_div() Sasha Levin
  2 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2024-11-12 10:35 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Luo Yifan, Mark Brown, Sasha Levin, olivier.moysan,
	arnaud.pouliquen, lgirdwood, perex, tiwai, mcoquelin.stm32,
	alexandre.torgue, alsa-devel, linux-sound, linux-stm32,
	linux-arm-kernel

From: Luo Yifan <luoyifan@cmss.chinamobile.com>

[ Upstream commit 63c1c87993e0e5bb11bced3d8224446a2bc62338 ]

This patch checks if div is less than or equal to zero (div <= 0). If
div is zero or negative, the function returns -EINVAL, ensuring the
division operation (*prate / div) is safe to perform.

Signed-off-by: Luo Yifan <luoyifan@cmss.chinamobile.com>
Link: https://patch.msgid.link/20241106014654.206860-1-luoyifan@cmss.chinamobile.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/stm/stm32_sai_sub.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c
index ad2492efb1cdc..19307812ec765 100644
--- a/sound/soc/stm/stm32_sai_sub.c
+++ b/sound/soc/stm/stm32_sai_sub.c
@@ -378,8 +378,8 @@ static long stm32_sai_mclk_round_rate(struct clk_hw *hw, unsigned long rate,
 	int div;
 
 	div = stm32_sai_get_clk_div(sai, *prate, rate);
-	if (div < 0)
-		return div;
+	if (div <= 0)
+		return -EINVAL;
 
 	mclk->freq = *prate / div;
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH AUTOSEL 6.11 14/16] ASoC: stm: Prevent potential division by zero in stm32_sai_get_clk_div()
       [not found] <20241112103605.1652910-1-sashal@kernel.org>
  2024-11-12 10:35 ` [PATCH AUTOSEL 6.11 07/16] ASoC: tas2781: Add new driver version for tas2563 & tas2781 qfn chip Sasha Levin
  2024-11-12 10:35 ` [PATCH AUTOSEL 6.11 13/16] ASoC: stm: Prevent potential division by zero in stm32_sai_mclk_round_rate() Sasha Levin
@ 2024-11-12 10:35 ` Sasha Levin
  2 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2024-11-12 10:35 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Luo Yifan, Olivier Moysan, Mark Brown, Sasha Levin,
	arnaud.pouliquen, lgirdwood, perex, tiwai, mcoquelin.stm32,
	alexandre.torgue, alsa-devel, linux-sound, linux-stm32,
	linux-arm-kernel

From: Luo Yifan <luoyifan@cmss.chinamobile.com>

[ Upstream commit 23569c8b314925bdb70dd1a7b63cfe6100868315 ]

This patch checks if div is less than or equal to zero (div <= 0). If
div is zero or negative, the function returns -EINVAL, ensuring the
division operation is safe to perform.

Signed-off-by: Luo Yifan <luoyifan@cmss.chinamobile.com>
Reviewed-by: Olivier Moysan <olivier.moysan@foss.st.com>
Link: https://patch.msgid.link/20241107015936.211902-1-luoyifan@cmss.chinamobile.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/stm/stm32_sai_sub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c
index 19307812ec765..64f52c75e2aa8 100644
--- a/sound/soc/stm/stm32_sai_sub.c
+++ b/sound/soc/stm/stm32_sai_sub.c
@@ -317,7 +317,7 @@ static int stm32_sai_get_clk_div(struct stm32_sai_sub_data *sai,
 	int div;
 
 	div = DIV_ROUND_CLOSEST(input_rate, output_rate);
-	if (div > SAI_XCR1_MCKDIV_MAX(version)) {
+	if (div > SAI_XCR1_MCKDIV_MAX(version) || div <= 0) {
 		dev_err(&sai->pdev->dev, "Divider %d out of range\n", div);
 		return -EINVAL;
 	}
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-11-12 10:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20241112103605.1652910-1-sashal@kernel.org>
2024-11-12 10:35 ` [PATCH AUTOSEL 6.11 07/16] ASoC: tas2781: Add new driver version for tas2563 & tas2781 qfn chip Sasha Levin
2024-11-12 10:35 ` [PATCH AUTOSEL 6.11 13/16] ASoC: stm: Prevent potential division by zero in stm32_sai_mclk_round_rate() Sasha Levin
2024-11-12 10:35 ` [PATCH AUTOSEL 6.11 14/16] ASoC: stm: Prevent potential division by zero in stm32_sai_get_clk_div() Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox