diff mbox series

[05/36] sparc: Check dev->realized at sparc_set_nwindows()

Message ID 20201029220246.472693-6-ehabkost@redhat.com
State Superseded
Headers show
Series Make qdev static property API usable by any QOM type | expand

Commit Message

Eduardo Habkost Oct. 29, 2020, 10:02 p.m. UTC
sparc_set_nwindows() is one of the very few property setters that
don't check dev->realized, and there's no reason for it to be
special.  Check dev->realized like the other setters.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: Artyom Tarasenko <atar4qemu@gmail.com>
Cc: qemu-devel@nongnu.org
---
 target/sparc/cpu.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Marc-André Lureau Oct. 30, 2020, 7:43 a.m. UTC | #1
On Fri, Oct 30, 2020 at 2:07 AM Eduardo Habkost <ehabkost@redhat.com> wrote:

> sparc_set_nwindows() is one of the very few property setters that

> don't check dev->realized, and there's no reason for it to be

> special.  Check dev->realized like the other setters.

>

> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

>


Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


-- 
Marc-André Lureau
<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 30, 2020 at 2:07 AM Eduardo Habkost &lt;<a href="mailto:ehabkost@redhat.com" target="_blank">ehabkost@redhat.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">sparc_set_nwindows() is one of the very few property setters that<br>
don&#39;t check dev-&gt;realized, and there&#39;s no reason for it to be<br>
special.  Check dev-&gt;realized like the other setters.<br>
<br>
Signed-off-by: Eduardo Habkost &lt;<a href="mailto:ehabkost@redhat.com" target="_blank">ehabkost@redhat.com</a>&gt;<br></blockquote><div><br></div><div>Reviewed-by: Marc-André Lureau &lt;<a href="mailto:marcandre.lureau@redhat.com" target="_blank">marcandre.lureau@redhat.com</a>&gt;</div><br></div>-- <br><div dir="ltr">Marc-André Lureau<br></div></div>
diff mbox series

Patch

diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
index cf21efd85f..8ecb20e55f 100644
--- a/target/sparc/cpu.c
+++ b/target/sparc/cpu.c
@@ -798,11 +798,17 @@  static void sparc_get_nwindows(Object *obj, Visitor *v, const char *name,
 static void sparc_set_nwindows(Object *obj, Visitor *v, const char *name,
                                void *opaque, Error **errp)
 {
+    DeviceState *dev = DEVICE(obj);
     const int64_t min = MIN_NWINDOWS;
     const int64_t max = MAX_NWINDOWS;
     SPARCCPU *cpu = SPARC_CPU(obj);
     int64_t value;
 
+    if (dev->realized) {
+        qdev_prop_set_after_realize(dev, name, errp);
+        return;
+    }
+
     if (!visit_type_int(v, name, &value, errp)) {
         return;
     }