linux-sound.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] ASoC: use int type to store negative error codes
@ 2025-08-28  7:53 Qianfeng Rong
  2025-08-28  7:53 ` [PATCH 1/3] ASoC: amd: " Qianfeng Rong
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Qianfeng Rong @ 2025-08-28  7:53 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Lars-Peter Clausen, Nuno Sá, Srinivas Kandagatla,
	Venkata Prasad Potturu, Vijendar Mukunda, Ingo Molnar,
	Charles Keepax, Mario Limonciello, Peter Zijlstra, Qianfeng Rong,
	open list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	open list, open list:QCOM AUDIO (ASoC) DRIVERS

The 'ret' variable usually is used to store returns from some functions,
which return either zero on success or negative error codes on failure.

Storing the negative error codes in unsigned type, doesn't cause an issue
at runtime but it's ugly as pants.  Additionally, assigning negative error
codes to unsigned type may trigger a GCC warning when the -Wsign-conversion
flag is enabled.

Change "ret" from u32/unsigned int to int type.  No effect on runtime.

Qianfeng Rong (3):
  ASoC: amd: use int type to store negative error codes
  ASoC: adau1977: use int type to store negative error codes
  ASoC: qcom: use int type to store negative error codes

 sound/soc/amd/acp/acp-rembrandt.c | 2 +-
 sound/soc/amd/raven/acp3x-i2s.c   | 3 ++-
 sound/soc/amd/vangogh/acp5x-i2s.c | 3 ++-
 sound/soc/codecs/adau1977.c       | 2 +-
 sound/soc/qcom/lpass-cdc-dma.c    | 3 ++-
 sound/soc/qcom/lpass-hdmi.c       | 2 +-
 6 files changed, 9 insertions(+), 6 deletions(-)

-- 
2.34.1


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

* [PATCH 1/3] ASoC: amd: use int type to store negative error codes
  2025-08-28  7:53 [PATCH 0/3] ASoC: use int type to store negative error codes Qianfeng Rong
@ 2025-08-28  7:53 ` Qianfeng Rong
  2025-08-28 13:30   ` Limonciello, Mario
  2025-08-28  7:53 ` [PATCH 2/3] ASoC: adau1977: " Qianfeng Rong
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Qianfeng Rong @ 2025-08-28  7:53 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Venkata Prasad Potturu, Vijendar Mukunda, Charles Keepax,
	Mario Limonciello, Peter Zijlstra, Qianfeng Rong,
	open list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	open list

Change the 'ret' variable from u32 to int to store negative error codes
directly or returned by other functions.

Storing the negative error codes in unsigned type, doesn't cause an issue
at runtime but it's ugly as pants. Additionally, assigning negative error
codes to unsigned type may trigger a GCC warning when the -Wsign-conversion
flag is enabled.

No effect on runtime.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
---
 sound/soc/amd/acp/acp-rembrandt.c | 2 +-
 sound/soc/amd/raven/acp3x-i2s.c   | 3 ++-
 sound/soc/amd/vangogh/acp5x-i2s.c | 3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/sound/soc/amd/acp/acp-rembrandt.c b/sound/soc/amd/acp/acp-rembrandt.c
index aeffd24710e7..7e9c07488dcc 100644
--- a/sound/soc/amd/acp/acp-rembrandt.c
+++ b/sound/soc/amd/acp/acp-rembrandt.c
@@ -147,7 +147,7 @@ static int rembrandt_audio_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct acp_chip_info *chip;
-	u32 ret;
+	int ret;
 
 	chip = dev_get_platdata(&pdev->dev);
 	if (!chip || !chip->base) {
diff --git a/sound/soc/amd/raven/acp3x-i2s.c b/sound/soc/amd/raven/acp3x-i2s.c
index e7f2a05e802c..352485dd98b1 100644
--- a/sound/soc/amd/raven/acp3x-i2s.c
+++ b/sound/soc/amd/raven/acp3x-i2s.c
@@ -149,8 +149,9 @@ static int acp3x_i2s_trigger(struct snd_pcm_substream *substream,
 				int cmd, struct snd_soc_dai *dai)
 {
 	struct i2s_stream_instance *rtd;
-	u32 ret, val, period_bytes, reg_val, ier_val, water_val;
+	u32 val, period_bytes, reg_val, ier_val, water_val;
 	u32 buf_size, buf_reg;
+	int ret;
 
 	rtd = substream->runtime->private_data;
 	period_bytes = frames_to_bytes(substream->runtime,
diff --git a/sound/soc/amd/vangogh/acp5x-i2s.c b/sound/soc/amd/vangogh/acp5x-i2s.c
index 7dbe33f4b867..bf719f628617 100644
--- a/sound/soc/amd/vangogh/acp5x-i2s.c
+++ b/sound/soc/amd/vangogh/acp5x-i2s.c
@@ -234,8 +234,9 @@ static int acp5x_i2s_trigger(struct snd_pcm_substream *substream,
 {
 	struct i2s_stream_instance *rtd;
 	struct i2s_dev_data *adata;
-	u32 ret, val, period_bytes, reg_val, ier_val, water_val;
+	u32 val, period_bytes, reg_val, ier_val, water_val;
 	u32 buf_size, buf_reg;
+	int ret;
 
 	adata = snd_soc_dai_get_drvdata(dai);
 	rtd = substream->runtime->private_data;
-- 
2.34.1


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

* [PATCH 2/3] ASoC: adau1977: use int type to store negative error codes
  2025-08-28  7:53 [PATCH 0/3] ASoC: use int type to store negative error codes Qianfeng Rong
  2025-08-28  7:53 ` [PATCH 1/3] ASoC: amd: " Qianfeng Rong
@ 2025-08-28  7:53 ` Qianfeng Rong
  2025-08-28 10:48   ` Nuno Sá
  2025-08-28  7:53 ` [PATCH 3/3] ASoC: qcom: " Qianfeng Rong
  2025-08-28 21:00 ` [PATCH 0/3] ASoC: " Mark Brown
  3 siblings, 1 reply; 8+ messages in thread
From: Qianfeng Rong @ 2025-08-28  7:53 UTC (permalink / raw)
  To: Lars-Peter Clausen, Nuno Sá, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai,
	open list:ANALOG DEVICES INC ASOC CODEC DRIVERS, open list
  Cc: Qianfeng Rong

Change the 'ret' variable from unsigned int to int to store negative error
codes or zero returned by regmap_update_bits().

Storing the negative error codes in unsigned type, doesn't cause an issue
at runtime but it's ugly as pants. Additionally, assigning negative error
codes to unsigned type may trigger a GCC warning when the -Wsign-conversion
flag is enabled.

No effect on runtime.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
---
 sound/soc/codecs/adau1977.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/adau1977.c b/sound/soc/codecs/adau1977.c
index ae59efb38f26..c193a9f22f59 100644
--- a/sound/soc/codecs/adau1977.c
+++ b/sound/soc/codecs/adau1977.c
@@ -795,7 +795,7 @@ static int adau1977_set_sysclk(struct snd_soc_component *component,
 	struct adau1977 *adau1977 = snd_soc_component_get_drvdata(component);
 	unsigned int mask = 0;
 	unsigned int clk_src;
-	unsigned int ret;
+	int ret;
 
 	if (dir != SND_SOC_CLOCK_IN)
 		return -EINVAL;
-- 
2.34.1


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

* [PATCH 3/3] ASoC: qcom: use int type to store negative error codes
  2025-08-28  7:53 [PATCH 0/3] ASoC: use int type to store negative error codes Qianfeng Rong
  2025-08-28  7:53 ` [PATCH 1/3] ASoC: amd: " Qianfeng Rong
  2025-08-28  7:53 ` [PATCH 2/3] ASoC: adau1977: " Qianfeng Rong
@ 2025-08-28  7:53 ` Qianfeng Rong
  2025-08-28 10:32   ` Dmitry Baryshkov
  2025-08-28 21:00 ` [PATCH 0/3] ASoC: " Mark Brown
  3 siblings, 1 reply; 8+ messages in thread
From: Qianfeng Rong @ 2025-08-28  7:53 UTC (permalink / raw)
  To: Srinivas Kandagatla, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, open list:QCOM AUDIO (ASoC) DRIVERS,
	open list:QCOM AUDIO (ASoC) DRIVERS, open list
  Cc: Qianfeng Rong

Change the 'ret' variable from unsigned int to int to store negative error
codes or zero returned by regmap_field_write().

Storing the negative error codes in unsigned type, doesn't cause an issue
at runtime but it's ugly as pants. Additionally, assigning negative error
codes to unsigned type may trigger a GCC warning when the -Wsign-conversion
flag is enabled.

No effect on runtime.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
---
 sound/soc/qcom/lpass-cdc-dma.c | 3 ++-
 sound/soc/qcom/lpass-hdmi.c    | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/sound/soc/qcom/lpass-cdc-dma.c b/sound/soc/qcom/lpass-cdc-dma.c
index 8106c586f68a..2dc8c75c4bf0 100644
--- a/sound/soc/qcom/lpass-cdc-dma.c
+++ b/sound/soc/qcom/lpass-cdc-dma.c
@@ -217,8 +217,9 @@ static int lpass_cdc_dma_daiops_hw_params(struct snd_pcm_substream *substream,
 {
 	struct snd_soc_pcm_runtime *soc_runtime = snd_soc_substream_to_rtd(substream);
 	struct lpaif_dmactl *dmactl = NULL;
-	unsigned int ret, regval;
+	unsigned int regval;
 	unsigned int channels = params_channels(params);
+	int ret;
 	int id;
 
 	switch (channels) {
diff --git a/sound/soc/qcom/lpass-hdmi.c b/sound/soc/qcom/lpass-hdmi.c
index ce753ebc0894..6d9795306cfa 100644
--- a/sound/soc/qcom/lpass-hdmi.c
+++ b/sound/soc/qcom/lpass-hdmi.c
@@ -23,7 +23,6 @@ static int lpass_hdmi_daiops_hw_params(struct snd_pcm_substream *substream,
 	snd_pcm_format_t format = params_format(params);
 	unsigned int rate = params_rate(params);
 	unsigned int channels = params_channels(params);
-	unsigned int ret;
 	int bitwidth;
 	unsigned int word_length;
 	unsigned int ch_sts_buf0;
@@ -33,6 +32,7 @@ static int lpass_hdmi_daiops_hw_params(struct snd_pcm_substream *substream,
 	unsigned int ch = 0;
 	struct lpass_dp_metadata_ctl *meta_ctl = drvdata->meta_ctl;
 	struct lpass_sstream_ctl *sstream_ctl = drvdata->sstream_ctl;
+	int ret;
 
 	bitwidth = snd_pcm_format_width(format);
 	if (bitwidth < 0) {
-- 
2.34.1


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

* Re: [PATCH 3/3] ASoC: qcom: use int type to store negative error codes
  2025-08-28  7:53 ` [PATCH 3/3] ASoC: qcom: " Qianfeng Rong
@ 2025-08-28 10:32   ` Dmitry Baryshkov
  0 siblings, 0 replies; 8+ messages in thread
From: Dmitry Baryshkov @ 2025-08-28 10:32 UTC (permalink / raw)
  To: Qianfeng Rong
  Cc: Srinivas Kandagatla, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, open list:QCOM AUDIO (ASoC) DRIVERS,
	open list:QCOM AUDIO (ASoC) DRIVERS, open list

On Thu, Aug 28, 2025 at 03:53:59PM +0800, Qianfeng Rong wrote:
> Change the 'ret' variable from unsigned int to int to store negative error
> codes or zero returned by regmap_field_write().
> 
> Storing the negative error codes in unsigned type, doesn't cause an issue
> at runtime but it's ugly as pants. Additionally, assigning negative error
> codes to unsigned type may trigger a GCC warning when the -Wsign-conversion
> flag is enabled.
> 
> No effect on runtime.
> 
> Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
> ---
>  sound/soc/qcom/lpass-cdc-dma.c | 3 ++-
>  sound/soc/qcom/lpass-hdmi.c    | 2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>


-- 
With best wishes
Dmitry

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

* Re: [PATCH 2/3] ASoC: adau1977: use int type to store negative error codes
  2025-08-28  7:53 ` [PATCH 2/3] ASoC: adau1977: " Qianfeng Rong
@ 2025-08-28 10:48   ` Nuno Sá
  0 siblings, 0 replies; 8+ messages in thread
From: Nuno Sá @ 2025-08-28 10:48 UTC (permalink / raw)
  To: Qianfeng Rong, Lars-Peter Clausen, Nuno Sá, Liam Girdwood,
	Mark Brown, Jaroslav Kysela, Takashi Iwai,
	open list:ANALOG DEVICES INC ASOC CODEC DRIVERS, open list

On Thu, 2025-08-28 at 15:53 +0800, Qianfeng Rong wrote:
> Change the 'ret' variable from unsigned int to int to store negative error
> codes or zero returned by regmap_update_bits().
> 
> Storing the negative error codes in unsigned type, doesn't cause an issue
> at runtime but it's ugly as pants. Additionally, assigning negative error
> codes to unsigned type may trigger a GCC warning when the -Wsign-conversion
> flag is enabled.
> 
> No effect on runtime.
> 
> Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
> ---

Reviewed-by: Nuno Sá <nuno.sa@analog.com>

>  sound/soc/codecs/adau1977.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/soc/codecs/adau1977.c b/sound/soc/codecs/adau1977.c
> index ae59efb38f26..c193a9f22f59 100644
> --- a/sound/soc/codecs/adau1977.c
> +++ b/sound/soc/codecs/adau1977.c
> @@ -795,7 +795,7 @@ static int adau1977_set_sysclk(struct snd_soc_component
> *component,
>  	struct adau1977 *adau1977 = snd_soc_component_get_drvdata(component);
>  	unsigned int mask = 0;
>  	unsigned int clk_src;
> -	unsigned int ret;
> +	int ret;
>  
>  	if (dir != SND_SOC_CLOCK_IN)
>  		return -EINVAL;

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

* Re: [PATCH 1/3] ASoC: amd: use int type to store negative error codes
  2025-08-28  7:53 ` [PATCH 1/3] ASoC: amd: " Qianfeng Rong
@ 2025-08-28 13:30   ` Limonciello, Mario
  0 siblings, 0 replies; 8+ messages in thread
From: Limonciello, Mario @ 2025-08-28 13:30 UTC (permalink / raw)
  To: Qianfeng Rong, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, Prasad, Prasad, Mukunda, Vijendar, Charles Keepax,
	Peter Zijlstra,
	open list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	open list

On 8/28/25 2:53 AM, Qianfeng Rong wrote:
> Change the 'ret' variable from u32 to int to store negative error codes
> directly or returned by other functions.
> 
> Storing the negative error codes in unsigned type, doesn't cause an issue
> at runtime but it's ugly as pants. Additionally, assigning negative error
> codes to unsigned type may trigger a GCC warning when the -Wsign-conversion
> flag is enabled.
> 
> No effect on runtime.
> 
> Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>

> ---
>   sound/soc/amd/acp/acp-rembrandt.c | 2 +-
>   sound/soc/amd/raven/acp3x-i2s.c   | 3 ++-
>   sound/soc/amd/vangogh/acp5x-i2s.c | 3 ++-
>   3 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/soc/amd/acp/acp-rembrandt.c b/sound/soc/amd/acp/acp-rembrandt.c
> index aeffd24710e7..7e9c07488dcc 100644
> --- a/sound/soc/amd/acp/acp-rembrandt.c
> +++ b/sound/soc/amd/acp/acp-rembrandt.c
> @@ -147,7 +147,7 @@ static int rembrandt_audio_probe(struct platform_device *pdev)
>   {
>   	struct device *dev = &pdev->dev;
>   	struct acp_chip_info *chip;
> -	u32 ret;
> +	int ret;
>   
>   	chip = dev_get_platdata(&pdev->dev);
>   	if (!chip || !chip->base) {
> diff --git a/sound/soc/amd/raven/acp3x-i2s.c b/sound/soc/amd/raven/acp3x-i2s.c
> index e7f2a05e802c..352485dd98b1 100644
> --- a/sound/soc/amd/raven/acp3x-i2s.c
> +++ b/sound/soc/amd/raven/acp3x-i2s.c
> @@ -149,8 +149,9 @@ static int acp3x_i2s_trigger(struct snd_pcm_substream *substream,
>   				int cmd, struct snd_soc_dai *dai)
>   {
>   	struct i2s_stream_instance *rtd;
> -	u32 ret, val, period_bytes, reg_val, ier_val, water_val;
> +	u32 val, period_bytes, reg_val, ier_val, water_val;
>   	u32 buf_size, buf_reg;
> +	int ret;
>   
>   	rtd = substream->runtime->private_data;
>   	period_bytes = frames_to_bytes(substream->runtime,
> diff --git a/sound/soc/amd/vangogh/acp5x-i2s.c b/sound/soc/amd/vangogh/acp5x-i2s.c
> index 7dbe33f4b867..bf719f628617 100644
> --- a/sound/soc/amd/vangogh/acp5x-i2s.c
> +++ b/sound/soc/amd/vangogh/acp5x-i2s.c
> @@ -234,8 +234,9 @@ static int acp5x_i2s_trigger(struct snd_pcm_substream *substream,
>   {
>   	struct i2s_stream_instance *rtd;
>   	struct i2s_dev_data *adata;
> -	u32 ret, val, period_bytes, reg_val, ier_val, water_val;
> +	u32 val, period_bytes, reg_val, ier_val, water_val;
>   	u32 buf_size, buf_reg;
> +	int ret;
>   
>   	adata = snd_soc_dai_get_drvdata(dai);
>   	rtd = substream->runtime->private_data;


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

* Re: [PATCH 0/3] ASoC: use int type to store negative error codes
  2025-08-28  7:53 [PATCH 0/3] ASoC: use int type to store negative error codes Qianfeng Rong
                   ` (2 preceding siblings ...)
  2025-08-28  7:53 ` [PATCH 3/3] ASoC: qcom: " Qianfeng Rong
@ 2025-08-28 21:00 ` Mark Brown
  3 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2025-08-28 21:00 UTC (permalink / raw)
  To: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Lars-Peter Clausen,
	Nuno Sá, Srinivas Kandagatla, Venkata Prasad Potturu,
	Vijendar Mukunda, Ingo Molnar, Charles Keepax, Mario Limonciello,
	Peter Zijlstra, linux-sound, linux-kernel, linux-arm-msm,
	Qianfeng Rong

On Thu, 28 Aug 2025 15:53:56 +0800, Qianfeng Rong wrote:
> The 'ret' variable usually is used to store returns from some functions,
> which return either zero on success or negative error codes on failure.
> 
> Storing the negative error codes in unsigned type, doesn't cause an issue
> at runtime but it's ugly as pants.  Additionally, assigning negative error
> codes to unsigned type may trigger a GCC warning when the -Wsign-conversion
> flag is enabled.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/3] ASoC: amd: use int type to store negative error codes
      commit: d985b60f47893e8fd43989662111bebe78311cd1
[2/3] ASoC: adau1977: use int type to store negative error codes
      commit: 784771cdd77091e7e93b78b5de55006295cc7b8e
[3/3] ASoC: qcom: use int type to store negative error codes
      commit: 11f5c5f9e43e9020bae452232983fe98e7abfce0

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


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

end of thread, other threads:[~2025-08-28 21:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-28  7:53 [PATCH 0/3] ASoC: use int type to store negative error codes Qianfeng Rong
2025-08-28  7:53 ` [PATCH 1/3] ASoC: amd: " Qianfeng Rong
2025-08-28 13:30   ` Limonciello, Mario
2025-08-28  7:53 ` [PATCH 2/3] ASoC: adau1977: " Qianfeng Rong
2025-08-28 10:48   ` Nuno Sá
2025-08-28  7:53 ` [PATCH 3/3] ASoC: qcom: " Qianfeng Rong
2025-08-28 10:32   ` Dmitry Baryshkov
2025-08-28 21:00 ` [PATCH 0/3] ASoC: " Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).