[alsa-devel] [PATCH 1/9] ASoC: ab8500: Add missing of NULL check of devm_kzalloc()

Takashi Iwai tiwai at suse.de
Wed Oct 30 08:34:59 CET 2013


Spotted by coverity CID 712316.

Signed-off-by: Takashi Iwai <tiwai at suse.de>
---
 sound/soc/codecs/ab8500-codec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/codecs/ab8500-codec.c b/sound/soc/codecs/ab8500-codec.c
index a0394a8f2257..6e3dda1ca734 100644
--- a/sound/soc/codecs/ab8500-codec.c
+++ b/sound/soc/codecs/ab8500-codec.c
@@ -2575,6 +2575,8 @@ static int ab8500_codec_driver_probe(struct platform_device *pdev)
 	/* Create driver private-data struct */
 	drvdata = devm_kzalloc(&pdev->dev, sizeof(struct ab8500_codec_drvdata),
 			GFP_KERNEL);
+	if (!drvdata)
+		return -ENOMEM;
 	drvdata->sid_status = SID_UNCONFIGURED;
 	drvdata->anc_status = ANC_UNCONFIGURED;
 	dev_set_drvdata(&pdev->dev, drvdata);
-- 
1.8.4.1



More information about the Alsa-devel mailing list