Skip to contentSkip to conversation

ASoC: hdmi-codec: Use devm_kcalloc() in hdmi_codec_probe()

PATCH New SF Markus Elfring 1 participant 1 message Apr 26, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: hdmi-codec: Use devm_kcalloc() in hdmi_codec_probe()

From: Markus Elfring <[email protected]>
Date: Wed, 26 Apr 2017 12:26:06 +0200

A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus use the corresponding function "devm_kcalloc".

This issue was detected by using the Coccinelle software.

---
 sound/soc/codecs/hdmi-codec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/codecs/hdmi-codec.c +1 -2
index 8c5ae1fc23a9..99933488fa03 100644
@@ -825,8 +825,7 @@ static int hdmi_codec_probe(struct platform_device *pdev)
 
 	hcp->hcd = *hcd;
 	mutex_init(&hcp->current_stream_lock);
-
-	hcp->daidrv = devm_kzalloc(dev, dai_count * sizeof(*hcp->daidrv),
+	hcp->daidrv = devm_kcalloc(dev, dai_count, sizeof(*hcp->daidrv),
 				   GFP_KERNEL);
 	if (!hcp->daidrv)
 		return -ENOMEM;
Signature · 1 line
2.12.2