summaryrefslogtreecommitdiff
path: root/drivers/mfd/jz4740-adc.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2010-08-02 05:02:02 +0400
committerSamuel Ortiz <sameo@linux.intel.com>2010-08-12 13:28:02 +0400
commit789133b7b4dd4915550733af5dc005ca89121c73 (patch)
tree8d31da0c6b8d4a837212dc4657033f8cf28db3c0 /drivers/mfd/jz4740-adc.c
parent48736c80e5d0c7c9db97bd6643a979a4ab11f25b (diff)
downloadlinux-789133b7b4dd4915550733af5dc005ca89121c73.tar.xz
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/mfd/jz4740-adc.c')
-rw-r--r--drivers/mfd/jz4740-adc.c4
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) {