diff options
author | Axel Lin <axel.lin@gmail.com> | 2010-08-02 09:02:02 +0800 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2010-08-12 11:28:02 +0200 |
commit | 789133b7b4dd4915550733af5dc005ca89121c73 (patch) | |
tree | 8d31da0c6b8d4a837212dc4657033f8cf28db3c0 /drivers | |
parent | 48736c80e5d0c7c9db97bd6643a979a4ab11f25b (diff) |
mfd: Check jz4740-adc kmalloc() result
If kmalloc() fails exit with -ENOMEM.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mfd/jz4740-adc.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/mfd/jz4740-adc.c b/drivers/mfd/jz4740-adc.c index b30e44ac4d1c..3ad492cb6c41 100644 --- a/drivers/mfd/jz4740-adc.c +++ b/drivers/mfd/jz4740-adc.c @@ -260,6 +260,10 @@ static int __devinit jz4740_adc_probe(struct platform_device *pdev) int irq; adc = kmalloc(sizeof(*adc), GFP_KERNEL); + if (!adc) { + dev_err(&pdev->dev, "Failed to allocate driver structure\n"); + return -ENOMEM; + } adc->irq = platform_get_irq(pdev, 0); if (adc->irq < 0) { |