qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Eduardo Habkost <ehabkost@redhat.com>, qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	qemu-trivial@nongnu.org, Krzysztof Kozlowski <krzk@kernel.org>
Subject: [Qemu-devel] [PATCH v2 2/2] qdev: Constify local variable returned by blk_bs
Date: Fri, 10 Mar 2017 22:05:50 +0200	[thread overview]
Message-ID: <20170310200550.13313-3-krzk@kernel.org> (raw)
In-Reply-To: <20170310200550.13313-1-krzk@kernel.org>

Inside qdev_prop_set_drive() the value returned by blk_bs() is passed
only as pointer to const to bdrv_get_node_name() and pointed values is
not modified in other places so this can be made const for code
safeness.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 hw/core/qdev-properties-system.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
index c34be1c1bace..0d40ce682d05 100644
--- a/hw/core/qdev-properties-system.c
+++ b/hw/core/qdev-properties-system.c
@@ -405,7 +405,7 @@ void qdev_prop_set_drive(DeviceState *dev, const char *name,
     if (value) {
         ref = blk_name(value);
         if (!*ref) {
-            BlockDriverState *bs = blk_bs(value);
+            const BlockDriverState *bs = blk_bs(value);
             if (bs) {
                 ref = bdrv_get_node_name(bs);
             }
-- 
2.9.3

  parent reply	other threads:[~2017-03-10 20:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-10 20:05 [Qemu-devel] [PATCH v2 0/2] qdev: Minor const improvements Krzysztof Kozlowski
2017-03-10 20:05 ` [Qemu-devel] [PATCH v2 1/2] qdev: Constify value passed to qdev_prop_set_macaddr Krzysztof Kozlowski
2017-03-13 18:07   ` Eduardo Habkost
2017-03-10 20:05 ` Krzysztof Kozlowski [this message]
2017-03-13 18:08   ` [Qemu-devel] [PATCH v2 2/2] qdev: Constify local variable returned by blk_bs Eduardo Habkost

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=20170310200550.13313-3-krzk@kernel.org \
    --to=krzk@kernel.org \
    --cc=ehabkost@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.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).