summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRobby Cai <R63905@freescale.com>2012-10-17 09:01:35 +0800
committerRobby Cai <R63905@freescale.com>2012-10-17 16:31:38 +0800
commit94689e1fed43ece131451a90f1716893a418cba0 (patch)
treec11671401d2b5d40c57f2a01a98f36b9a4f84881 /drivers
parent259601771ec9bf815df3598e712de99c2b5e9c80 (diff)
ENGR00229938 pxp/v4l2: check return value of kmalloc against NULL
This is needed sanity check, because on Ubuntu it's likely that low memory will happen. This patch also makes this memory allocated from dma zone. Signed-off-by: Robby Cai <R63905@freescale.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/mxc/output/mxc_pxp_v4l2.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/media/video/mxc/output/mxc_pxp_v4l2.c b/drivers/media/video/mxc/output/mxc_pxp_v4l2.c
index c17f9f1d9cdc..08d16b9f75d3 100644
--- a/drivers/media/video/mxc/output/mxc_pxp_v4l2.c
+++ b/drivers/media/video/mxc/output/mxc_pxp_v4l2.c
@@ -396,7 +396,12 @@ static int pxp_s_output(struct file *file, void *fh,
bpp = 2;
pxp->outb_size = fmt->width * fmt->height * bpp;
- pxp->outb = kmalloc(fmt->width * fmt->height * bpp, GFP_KERNEL);
+ pxp->outb = kmalloc(fmt->width * fmt->height * bpp,
+ GFP_KERNEL | GFP_DMA);
+ if (pxp->outb == NULL) {
+ dev_err(&pxp->pdev->dev, "No enough memory!\n");
+ return -ENOMEM;
+ }
pxp->outb_phys = virt_to_phys(pxp->outb);
dma_map_single(NULL, pxp->outb,
fmt->width * fmt->height * bpp, DMA_TO_DEVICE);