From 789133b7b4dd4915550733af5dc005ca89121c73 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 2 Aug 2010 09:02:02 +0800 Subject: [PATCH] mfd: Check jz4740-adc kmalloc() result If kmalloc() fails exit with -ENOMEM. Signed-off-by: Axel Lin Signed-off-by: Samuel Ortiz --- drivers/mfd/jz4740-adc.c | 4 ++++ 1 file changed, 4 insertions(+) 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) { -- 2.11.0