[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1343298534-13611-5-git-send-email-lee.jones@linaro.org>
Date: Thu, 26 Jul 2012 11:28:37 +0100
From: Lee Jones <lee.jones@...aro.org>
To: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Cc: STEricsson_nomadik_linux@...t.st.com, linus.walleij@...ricsson.com,
arnd@...db.de, broonie@...nsource.wolfsonmicro.com,
sameo@...ux.intel.com, olalilja@...oo.se,
ola.o.lilja@...ricsson.com, alsa-devel@...a-project.org,
lrg@...com, Lee Jones <lee.jones@...aro.org>
Subject: [PATCH 04/21] ASoC: ux500: Strengthen error checking after memory allocation
Currently there is no out-of-memory error checking after attempting
to allocate memory for the ux500_msp or ux500_msp_i2s_drvdata data
structures. Instead we go about populating them regardless. This
patch applies the necessary error checking to prevent a panic.
Signed-off-by: Lee Jones <lee.jones@...aro.org>
---
sound/soc/ux500/ux500_msp_dai.c | 3 +++
sound/soc/ux500/ux500_msp_i2s.c | 2 ++
2 files changed, 5 insertions(+)
diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c
index 62ac0285..cdbbdaf 100644
--- a/sound/soc/ux500/ux500_msp_dai.c
+++ b/sound/soc/ux500/ux500_msp_dai.c
@@ -760,6 +760,9 @@ static int __devinit ux500_msp_drv_probe(struct platform_device *pdev)
drvdata = devm_kzalloc(&pdev->dev,
sizeof(struct ux500_msp_i2s_drvdata),
GFP_KERNEL);
+ if (!drvdata)
+ return -ENOMEM;
+
drvdata->fmt = 0;
drvdata->slots = 1;
drvdata->tx_mask = 0x01;
diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c
index ee14d2d..4c79850 100644
--- a/sound/soc/ux500/ux500_msp_i2s.c
+++ b/sound/soc/ux500/ux500_msp_i2s.c
@@ -673,6 +673,8 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev,
*msp_p = devm_kzalloc(&pdev->dev, sizeof(struct ux500_msp), GFP_KERNEL);
msp = *msp_p;
+ if (!msp)
+ return -ENOMEM;
msp->id = platform_data->id;
msp->dev = &pdev->dev;
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists