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>
This commit is contained in:
Axel Lin 2010-08-02 09:02:02 +08:00 committed by Samuel Ortiz
parent 48736c80e5
commit 789133b7b4
1 changed files with 4 additions and 0 deletions

View File

@ -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) {