qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: "Eugenio Pérez" <eperezma@redhat.com>, qemu-devel@nongnu.org
Cc: Eduardo Habkost <ehabkost@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	qemu-trivial@nongnu.org, Jason Wang <jasowang@redhat.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	Peter Xu <peterx@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH 1/1] util: Make some iova_tree parameters const
Date: Wed, 13 Oct 2021 00:21:25 +0200	[thread overview]
Message-ID: <4af0e643-b80a-7a77-bf4c-f3bff68d70f7@redhat.com> (raw)
In-Reply-To: <20211012155001.811160-2-eperezma@redhat.com>

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 <eperezma@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é <philmd@redhat.com>



  parent reply	other threads:[~2021-10-12 22:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-12 15:50 [PATCH 0/1] util: Make some iova_tree functions parameters const Eugenio Pérez
2021-10-12 15:50 ` [PATCH 1/1] util: Make some iova_tree " Eugenio Pérez
2021-10-12 21:35   ` Peter Xu
2021-10-12 22:21   ` Philippe Mathieu-Daudé [this message]
2021-10-13 18:26     ` Eugenio Perez Martin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4af0e643-b80a-7a77-bf4c-f3bff68d70f7@redhat.com \
    --to=philmd@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=eperezma@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).