When vmap fails, the lack of error-handling code may cause unexpected results. This patch adds error-handling code after calling vmap. Signed-off-by: Zhouyang Jia <jiazhouyang09@xxxxxxxxx> --- drivers/staging/comedi/comedi_buf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c index f693c2c..5e48693 100644 --- a/drivers/staging/comedi/comedi_buf.c +++ b/drivers/staging/comedi/comedi_buf.c @@ -132,9 +132,12 @@ static void __comedi_buf_alloc(struct comedi_device *dev, spin_unlock_irqrestore(&s->spin_lock, flags); /* vmap the prealloc_buf if all the pages were allocated */ - if (i == n_pages) + if (i == n_pages) { async->prealloc_buf = vmap(pages, n_pages, VM_MAP, COMEDI_PAGE_PROTECTION); + if (!async->prealloc_buf) + dev_err(dev->class_dev, "failed to vmap pages\n"); + } vfree(pages); } -- 2.7.4 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel