All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] ASoC: rsnd: make main_rate signed to check for -ve error return codes
@ 2017-06-19 16:35 ` Colin King
  0 siblings, 0 replies; 4+ messages in thread
From: Colin King @ 2017-06-19 16:35 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Kuninori Morimoto, Julia Lawall, alsa-devel
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The comparison of main_rate < 0 has no effect because main_rate is
an unsigned int. Make it signed so that any -ve error returns from the
call to rsnd_clk_query can be detected.

Detected by CoverityScan, CID#1446152 ("Unsigned compared against 0")

Fixes: ef4cf5d6a143e0 ("ASoC: rsnd: add rsnd_ssi_clk_query()")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 sound/soc/sh/rcar/ssi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index c8956c3484dd..d220512918f9 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -258,7 +258,7 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod,
 	struct rsnd_mod *ssi_parent_mod = rsnd_io_to_mod_ssip(io);
 	int chan = rsnd_runtime_channel_for_ssi(io);
 	int idx, ret;
-	unsigned int main_rate;
+	int main_rate;
 	unsigned int rate = rsnd_io_is_play(io) ?
 		rsnd_src_get_out_rate(priv, io) :
 		rsnd_src_get_in_rate(priv, io);
-- 
2.11.0

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

* [PATCH][next] ASoC: rsnd: make main_rate signed to check for -ve error return codes
@ 2017-06-19 16:35 ` Colin King
  0 siblings, 0 replies; 4+ messages in thread
From: Colin King @ 2017-06-19 16:35 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Kuninori Morimoto, Julia Lawall, alsa-devel
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The comparison of main_rate < 0 has no effect because main_rate is
an unsigned int. Make it signed so that any -ve error returns from the
call to rsnd_clk_query can be detected.

Detected by CoverityScan, CID#1446152 ("Unsigned compared against 0")

Fixes: ef4cf5d6a143e0 ("ASoC: rsnd: add rsnd_ssi_clk_query()")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 sound/soc/sh/rcar/ssi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index c8956c3484dd..d220512918f9 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -258,7 +258,7 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod,
 	struct rsnd_mod *ssi_parent_mod = rsnd_io_to_mod_ssip(io);
 	int chan = rsnd_runtime_channel_for_ssi(io);
 	int idx, ret;
-	unsigned int main_rate;
+	int main_rate;
 	unsigned int rate = rsnd_io_is_play(io) ?
 		rsnd_src_get_out_rate(priv, io) :
 		rsnd_src_get_in_rate(priv, io);
-- 
2.11.0


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

* Re: [PATCH][next] ASoC: rsnd: make main_rate signed to check for -ve error return codes
  2017-06-19 16:35 ` Colin King
@ 2017-06-20  0:01   ` Kuninori Morimoto
  -1 siblings, 0 replies; 4+ messages in thread
From: Kuninori Morimoto @ 2017-06-20  0:01 UTC (permalink / raw)
  To: Colin King
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Julia Lawall, alsa-devel, kernel-janitors, linux-kernel


Hi Colin

> From: Colin Ian King <colin.king@canonical.com>
> 
> The comparison of main_rate < 0 has no effect because main_rate is
> an unsigned int. Make it signed so that any -ve error returns from the
> call to rsnd_clk_query can be detected.
> 
> Detected by CoverityScan, CID#1446152 ("Unsigned compared against 0")
> 
> Fixes: ef4cf5d6a143e0 ("ASoC: rsnd: add rsnd_ssi_clk_query()")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---

Thank you for your patch.
But, I posted this fixup patch (not yet accepted)

To: Mark Brown <broonie@kernel.org>, Julia Lawall <julia.lawall@lip6.fr>
Subject: [PATCH] ASoC: rsnd: fixup unsigned expression compared with zero: main_rate
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
CC: Linux-ALSA <alsa-devel@alsa-project.org>, Simon <horms@verge.net.au>,
 <linux-renesas-soc@vger.kernel.org>
Date: Fri, 16 Jun 2017 00:02:59 +0000

>  sound/soc/sh/rcar/ssi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
> index c8956c3484dd..d220512918f9 100644
> --- a/sound/soc/sh/rcar/ssi.c
> +++ b/sound/soc/sh/rcar/ssi.c
> @@ -258,7 +258,7 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod,
>  	struct rsnd_mod *ssi_parent_mod = rsnd_io_to_mod_ssip(io);
>  	int chan = rsnd_runtime_channel_for_ssi(io);
>  	int idx, ret;
> -	unsigned int main_rate;
> +	int main_rate;
>  	unsigned int rate = rsnd_io_is_play(io) ?
>  		rsnd_src_get_out_rate(priv, io) :
>  		rsnd_src_get_in_rate(priv, io);
> -- 
> 2.11.0
> 

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

* Re: [PATCH][next] ASoC: rsnd: make main_rate signed to check for -ve error return codes
@ 2017-06-20  0:01   ` Kuninori Morimoto
  0 siblings, 0 replies; 4+ messages in thread
From: Kuninori Morimoto @ 2017-06-20  0:01 UTC (permalink / raw)
  To: Colin King
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Julia Lawall, alsa-devel, kernel-janitors, linux-kernel


Hi Colin

> From: Colin Ian King <colin.king@canonical.com>
> 
> The comparison of main_rate < 0 has no effect because main_rate is
> an unsigned int. Make it signed so that any -ve error returns from the
> call to rsnd_clk_query can be detected.
> 
> Detected by CoverityScan, CID#1446152 ("Unsigned compared against 0")
> 
> Fixes: ef4cf5d6a143e0 ("ASoC: rsnd: add rsnd_ssi_clk_query()")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---

Thank you for your patch.
But, I posted this fixup patch (not yet accepted)

To: Mark Brown <broonie@kernel.org>, Julia Lawall <julia.lawall@lip6.fr>
Subject: [PATCH] ASoC: rsnd: fixup unsigned expression compared with zero: main_rate
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
CC: Linux-ALSA <alsa-devel@alsa-project.org>, Simon <horms@verge.net.au>,
 <linux-renesas-soc@vger.kernel.org>
Date: Fri, 16 Jun 2017 00:02:59 +0000

>  sound/soc/sh/rcar/ssi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
> index c8956c3484dd..d220512918f9 100644
> --- a/sound/soc/sh/rcar/ssi.c
> +++ b/sound/soc/sh/rcar/ssi.c
> @@ -258,7 +258,7 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod,
>  	struct rsnd_mod *ssi_parent_mod = rsnd_io_to_mod_ssip(io);
>  	int chan = rsnd_runtime_channel_for_ssi(io);
>  	int idx, ret;
> -	unsigned int main_rate;
> +	int main_rate;
>  	unsigned int rate = rsnd_io_is_play(io) ?
>  		rsnd_src_get_out_rate(priv, io) :
>  		rsnd_src_get_in_rate(priv, io);
> -- 
> 2.11.0
> 

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

end of thread, other threads:[~2017-06-20  0:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-19 16:35 [PATCH][next] ASoC: rsnd: make main_rate signed to check for -ve error return codes Colin King
2017-06-19 16:35 ` Colin King
2017-06-20  0:01 ` Kuninori Morimoto
2017-06-20  0:01   ` Kuninori Morimoto

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.