On Sat, May 16, 2026 at 6:02 PM Marc-André Lureau
<[email protected]> wrote:
>
> The values stored in user_options are never retrieved, only key
> presence is checked. Use g_hash_table_add() instead of
> g_hash_table_insert() and drop the unused value parameter.
>
> Signed-off-by: Marc-André Lureau <[email protected]>

Reviewed-by: Alistair Francis <[email protected]>

Alistair

> ---
>  target/riscv/cpu.c | 32 +++++++++++++++-----------------
>  1 file changed, 15 insertions(+), 17 deletions(-)
>
> diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
> index bbdc9d8f5de..6adba597969 100644
> --- a/target/riscv/cpu.c
> +++ b/target/riscv/cpu.c
> @@ -60,11 +60,9 @@ bool riscv_cpu_is_32bit(RISCVCPU *cpu)
>      return riscv_cpu_mxl(&cpu->env) == MXL_RV32;
>  }
>
> -static void cpu_option_add_user_setting(RISCVCPU *cpu, const char *optname,
> -                                        uint32_t value)
> +static void cpu_option_add_user_setting(RISCVCPU *cpu, const char *optname)
>  {
> -    g_hash_table_insert(cpu->user_options, (gpointer)optname,
> -                        GUINT_TO_POINTER(value));
> +    g_hash_table_add(cpu->user_options, (gpointer)optname);
>  }
>
>  bool riscv_cpu_option_set(RISCVCPU *cpu, const char *optname)
> @@ -1452,7 +1450,7 @@ static void prop_pmu_num_set(Object *obj, Visitor *v, 
> const char *name,
>
>      warn_report("\"pmu-num\" property is deprecated; use \"pmu-mask\"");
>      cpu->cfg.pmu_mask = pmu_mask;
> -    cpu_option_add_user_setting(cpu, "pmu-mask", pmu_mask);
> +    cpu_option_add_user_setting(cpu, "pmu-mask");
>  }
>
>  static void prop_pmu_num_get(Object *obj, Visitor *v, const char *name,
> @@ -1494,7 +1492,7 @@ static void prop_pmu_mask_set(Object *obj, Visitor *v, 
> const char *name,
>          return;
>      }
>
> -    cpu_option_add_user_setting(cpu, name, value);
> +    cpu_option_add_user_setting(cpu, name);
>      cpu->cfg.pmu_mask = value;
>  }
>
> @@ -1526,7 +1524,7 @@ static void prop_mmu_set(Object *obj, Visitor *v, const 
> char *name,
>          return;
>      }
>
> -    cpu_option_add_user_setting(cpu, name, value);
> +    cpu_option_add_user_setting(cpu, name);
>      cpu->cfg.mmu = value;
>  }
>
> @@ -1558,7 +1556,7 @@ static void prop_pmp_set(Object *obj, Visitor *v, const 
> char *name,
>          return;
>      }
>
> -    cpu_option_add_user_setting(cpu, name, value);
> +    cpu_option_add_user_setting(cpu, name);
>      cpu->cfg.pmp = value;
>  }
>
> @@ -1598,7 +1596,7 @@ static void prop_num_pmp_regions_set(Object *obj, 
> Visitor *v, const char *name,
>          return;
>      }
>
> -    cpu_option_add_user_setting(cpu, name, value);
> +    cpu_option_add_user_setting(cpu, name);
>      cpu->cfg.pmp_regions = value;
>  }
>
> @@ -1636,7 +1634,7 @@ static void prop_pmp_granularity_set(Object *obj, 
> Visitor *v, const char *name,
>          return;
>      }
>
> -    cpu_option_add_user_setting(cpu, name, value);
> +    cpu_option_add_user_setting(cpu, name);
>      cpu->cfg.pmp_granularity = value;
>  }
>
> @@ -1709,7 +1707,7 @@ static void prop_priv_spec_set(Object *obj, Visitor *v, 
> const char *name,
>          return;
>      }
>
> -    cpu_option_add_user_setting(cpu, name, priv_version);
> +    cpu_option_add_user_setting(cpu, name);
>      cpu->env.priv_ver = priv_version;
>  }
>
> @@ -1743,7 +1741,7 @@ static void prop_vext_spec_set(Object *obj, Visitor *v, 
> const char *name,
>          return;
>      }
>
> -    cpu_option_add_user_setting(cpu, name, VEXT_VERSION_1_00_0);
> +    cpu_option_add_user_setting(cpu, name);
>      cpu->env.vext_ver = VEXT_VERSION_1_00_0;
>  }
>
> @@ -1786,7 +1784,7 @@ static void prop_vlen_set(Object *obj, Visitor *v, 
> const char *name,
>          return;
>      }
>
> -    cpu_option_add_user_setting(cpu, name, value);
> +    cpu_option_add_user_setting(cpu, name);
>      cpu->cfg.vlenb = value >> 3;
>  }
>
> @@ -1827,7 +1825,7 @@ static void prop_elen_set(Object *obj, Visitor *v, 
> const char *name,
>          return;
>      }
>
> -    cpu_option_add_user_setting(cpu, name, value);
> +    cpu_option_add_user_setting(cpu, name);
>      cpu->cfg.elen = value;
>  }
>
> @@ -1863,7 +1861,7 @@ static void prop_cbom_blksize_set(Object *obj, Visitor 
> *v, const char *name,
>          return;
>      }
>
> -    cpu_option_add_user_setting(cpu, name, value);
> +    cpu_option_add_user_setting(cpu, name);
>      cpu->cfg.cbom_blocksize = value;
>  }
>
> @@ -1899,7 +1897,7 @@ static void prop_cbop_blksize_set(Object *obj, Visitor 
> *v, const char *name,
>          return;
>      }
>
> -    cpu_option_add_user_setting(cpu, name, value);
> +    cpu_option_add_user_setting(cpu, name);
>      cpu->cfg.cbop_blocksize = value;
>  }
>
> @@ -1935,7 +1933,7 @@ static void prop_cboz_blksize_set(Object *obj, Visitor 
> *v, const char *name,
>          return;
>      }
>
> -    cpu_option_add_user_setting(cpu, name, value);
> +    cpu_option_add_user_setting(cpu, name);
>      cpu->cfg.cboz_blocksize = value;
>  }
>
>
> --
> 2.54.0
>
>

Reply via email to