Re: [PATCH] staging: comedi: use dma_mmap_coherent for DMA-able buffer mmap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 25, 2019 at 02:21:41PM +0100, Ian Abbott wrote:
> On 25/06/2019 12:47, Dan Carpenter wrote:
> > On Tue, Jun 25, 2019 at 12:26:59PM +0100, Ian Abbott wrote:
> > > +		} else {
> > > +			for (i = 0; i < bm->n_pages; i++) {
> > > +				buf = &bm->page_list[i];
> > > +				ClearPageReserved(virt_to_page(buf->virt_addr));
> > 
> > I think we need a NULL check here:
> > 
> > 	if (!buf->virt_addr)
> > 		continue;
> > 
> > >   				free_page((unsigned long)buf->virt_addr);
> > >   			}
> > >   		}
> 
> Hi Dan, I don't think that is strictly required because bm->n_pages gets set
> to the number of successfully allocated pages (not the number of required
> pages) by comedi_buf_map_alloc():
> 
> > +		for (i = 0; i < n_pages; i++) {
> > +			buf = &bm->page_list[i];
> > +			buf->virt_addr = (void *)get_zeroed_page(GFP_KERNEL);
> > +			if (!buf->virt_addr)
> > +				break;
> > +
> > +			SetPageReserved(virt_to_page(buf->virt_addr));
> > +		}
> > +
> > +		bm->n_pages = i;
> 
> Here!           ^
> 

Oh, yeah.  I misread.  Sorry for the noise.

regards,
dan carpenter


_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux