Re: [PATCH v2 1/3] media/videobuf2-dma-sg: Fix handling of sg_table structure

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

 



Hello all

On Fri, Feb 13, 2015 at 4:32 PM, Hans Verkuil <hverkuil@xxxxxxxxx> wrote:

> Yes please. And if Ricardo is correct, then someone (janitor job?) should do
> a review of dma_unmap_sg in particular.

Perhaps a code snippet inside scatterlist.h will clarify even more.

Would any of the maintainers accept a patch to include a comment like:

struct sg_table *sgt;

sgt = kzalloc(sizeof(*sgt);
if (!sgt){
return -ENOMEM;
}

ret = sg_alloc_table(sgt, N_NENTS, GPF_KERNEL);
if (ret){
  kfree(sgt);
  return ret;
}

//Fill sgt using orig_nents or nents  as index

sgt->nents = dma_map_sg(dev, sgt->sgl, sgt->orig_nents, DIR);
if (!sgt->nents){
  sg_free_table(sgt);
  kfree(sgt);
  return -EIO;
}

//Use nent  as index

dma_unmap_sg(dev, sgt->sgl, sgt->orig_nents, DIR);
sg_free_table(sgt);
kfree(sgt);
return 0



Thanks!


-- 
Ricardo Ribalda
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux