On Wed, Oct 13, 2021 at 12:21 AM Philippe Mathieu-Daudé
<phi...@redhat.com> wrote:
>
> On 10/12/21 17:50, Eugenio Pérez wrote:
> > As qemu guidelines:
> > Unless a pointer is used to modify the pointed-to storage, give it the
> > "const" attribute.
> >
> > In the particular case of iova_tree_find it allows to enforce what is
> > requested by its comment, since the compiler would shout in case of
> > modifying or freeing the const-qualified returned pointer.
> >
> > Signed-off-by: Eugenio Pérez <epere...@redhat.com>
> > ---
> >  include/qemu/iova-tree.h |  8 ++++----
> >  hw/i386/intel_iommu.c    |  2 +-
> >  util/iova-tree.c         | 10 +++++-----
> >  3 files changed, 10 insertions(+), 10 deletions(-)
>
> > -DMAMap *iova_tree_find_address(IOVATree *tree, hwaddr iova)
> > +const DMAMap *iova_tree_find_address(const IOVATree *tree, hwaddr iova)
> >  {
> >      DMAMap map = { .iova = iova, .size = 0 };
>
> You missed this one ^
>
> With it declared const:
> Reviewed-by: Philippe Mathieu-Daudé <phi...@redhat.com>
>

Right! Sending v2.

Thanks!


Reply via email to