Skip to contentSkip to conversation

target/s390x/cpu_models: Use 'first_cpu' in s390_get_feat_block()

PATCH In review Philippe Mathieu-Daudé 2 participants 2 messages Oct 30, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/s390x/cpu_models: Use 'first_cpu' in s390_get_feat_block()

We already have a global 'first_cpu' variable storing a pointer to the first CPU, no need to use a static one.

---
 target/s390x/cpu_models.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
target/s390x/cpu_models.c +1 -5
index 4dead48650..540d445023 100644
@@ -196,11 +196,7 @@ uint32_t s390_get_ibc_val(void)
 
 void s390_get_feat_block(S390FeatType type, uint8_t *data)
 {
-    static S390CPU *cpu;
-
-    if (!cpu) {
-        cpu = S390_CPU(qemu_get_cpu(0));
-    }
+    S390CPU *cpu = S390_CPU(first_cpu);
 
     if (!cpu || !cpu->model) {
         return;
Signature · 1 line
2.41.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Philippe Mathieu-Daudé

We already have a global 'first_cpu' variable storing a pointer to the first CPU, no need to use a static one.

---
  target/s390x/cpu_models.c | 6 +-----
  1 file changed, 1 insertion(+), 5 deletions(-)
target/s390x/cpu_models.c +0 -0
index 4dead48650..540d445023 100644
@@ -196,11 +196,7 @@ uint32_t s390_get_ibc_val(void)
 
  void s390_get_feat_block(S390FeatType type, uint8_t *data)

target/s390x/cpu_models.c uint32_t s390_get_ibc_val(void) · line 202

Quoted 10 lines
target/s390x/cpu_models.c +1 -5
  {
-    static S390CPU *cpu;
-
-    if (!cpu) {
-        cpu = S390_CPU(qemu_get_cpu(0));
-    }
+    S390CPU *cpu = S390_CPU(first_cpu);
 
      if (!cpu || !cpu->model) {
          return;
Signature · 3 lines
Cheers,

David / dhildenb