diff options
author | Lee Jones <lee.jones@linaro.org> | 2012-07-26 06:28:37 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-08-03 18:03:55 -0400 |
commit | 0dcd47426abde223b2386165470ec45d9777478e (patch) | |
tree | 4dd22c7e7ffbc223f33b5951b2a111f0d0d8942d /sound/soc/ux500 | |
parent | fbfe69836c088bcc0c5a0f32e788d3aef5f66aca (diff) |
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@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/ux500')
-rw-r--r-- | sound/soc/ux500/ux500_msp_dai.c | 3 | ||||
-rw-r--r-- | sound/soc/ux500/ux500_msp_i2s.c | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c index 057e28ef770e..772cb19d2fb3 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) | |||
760 | drvdata = devm_kzalloc(&pdev->dev, | 760 | drvdata = devm_kzalloc(&pdev->dev, |
761 | sizeof(struct ux500_msp_i2s_drvdata), | 761 | sizeof(struct ux500_msp_i2s_drvdata), |
762 | GFP_KERNEL); | 762 | GFP_KERNEL); |
763 | if (!drvdata) | ||
764 | return -ENOMEM; | ||
765 | |||
763 | drvdata->fmt = 0; | 766 | drvdata->fmt = 0; |
764 | drvdata->slots = 1; | 767 | drvdata->slots = 1; |
765 | drvdata->tx_mask = 0x01; | 768 | drvdata->tx_mask = 0x01; |
diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c index 5c472f335a64..36be11e47ad6 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, | |||
673 | 673 | ||
674 | *msp_p = devm_kzalloc(&pdev->dev, sizeof(struct ux500_msp), GFP_KERNEL); | 674 | *msp_p = devm_kzalloc(&pdev->dev, sizeof(struct ux500_msp), GFP_KERNEL); |
675 | msp = *msp_p; | 675 | msp = *msp_p; |
676 | if (!msp) | ||
677 | return -ENOMEM; | ||
676 | 678 | ||
677 | msp->id = platform_data->id; | 679 | msp->id = platform_data->id; |
678 | msp->dev = &pdev->dev; | 680 | msp->dev = &pdev->dev; |