[lkml]   [2021]   [Jun]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH][next][V2] ASoC: rsnd: check for zero node count
From: Colin Ian King <>

Most callers of_get_child_count() check that "nr" is non-zero so it
causes a static checker warning when we don't do that here. This
does not cause a problem or a crash, but having zero SSUIes does not
make sense either so let's add a check.

Addresses-Coverity: ("Unchecked return value")
Fixes: c413983eb66a ("ASoC: rsnd: adjust disabled module")
Acked-by: Kuninori Morimoto <>
Signed-off-by: Colin Ian King <>
V2: Rephrase commit message based on Dan Carpenter's suggestion.
Thanks Dan!

sound/soc/sh/rcar/ssiu.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/sound/soc/sh/rcar/ssiu.c b/sound/soc/sh/rcar/ssiu.c
index 5682c74bb7ff..0d8f97633dd2 100644
--- a/sound/soc/sh/rcar/ssiu.c
+++ b/sound/soc/sh/rcar/ssiu.c
@@ -515,6 +515,9 @@ int rsnd_ssiu_probe(struct rsnd_priv *priv)
nr = priv->ssi_nr;

+ if (!nr)
+ return -EINVAL;
ssiu = devm_kcalloc(dev, nr, sizeof(*ssiu), GFP_KERNEL);
if (!ssiu)
return -ENOMEM;
 \ /
  Last update: 2021-06-03 13:04    [W:0.041 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site