diff options
author | Axel Lin <axel.lin@gmail.com> | 2010-08-01 21:02:02 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2010-08-12 05:28:02 -0400 |
commit | 789133b7b4dd4915550733af5dc005ca89121c73 (patch) | |
tree | 8d31da0c6b8d4a837212dc4657033f8cf28db3c0 /drivers/mfd | |
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/mfd')
-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) | |||
260 | int irq; | 260 | int irq; |
261 | 261 | ||
262 | adc = kmalloc(sizeof(*adc), GFP_KERNEL); | 262 | adc = kmalloc(sizeof(*adc), GFP_KERNEL); |
263 | if (!adc) { | ||
264 | dev_err(&pdev->dev, "Failed to allocate driver structure\n"); | ||
265 | return -ENOMEM; | ||
266 | } | ||
263 | 267 | ||
264 | adc->irq = platform_get_irq(pdev, 0); | 268 | adc->irq = platform_get_irq(pdev, 0); |
265 | if (adc->irq < 0) { | 269 | if (adc->irq < 0) { |