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>
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);