From: Axel Lin Date: Mon, 2 Aug 2010 01:02:02 +0000 (+0800) Subject: mfd: Check jz4740-adc kmalloc() result X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=789133b7b4dd4915550733af5dc005ca89121c73;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git mfd: Check jz4740-adc kmalloc() result If kmalloc() fails exit with -ENOMEM. Signed-off-by: Axel Lin Signed-off-by: Samuel Ortiz --- 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) {