Eduardo Habkost <ehabkost(a)redhat.com> writes:
Instead of using custom feature name lookup code for
plus_features/minus_features, save the property names used in
"[+-]feature" and use object_property_set_bool() to set them.
We don't need a feat2prop() call because we now have alias
properties for the old names containing underscores.
Signed-off-by: Eduardo Habkost <ehabkost(a)redhat.com>
---
Changes v4 -> v5:
* Removed feat2prop() call, as we now have property aliases for
the old names containing underscores
Changes series v3 -> v4:
* New patch added to series
---
target-i386/cpu.c | 106 +++++++++++-------------------------------------------
1 file changed, 20 insertions(+), 86 deletions(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 6b5bf59..cef4ecd 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
[...]
@@ -2047,10 +1967,12 @@ static void x86_cpu_parse_featurestr(const
char *typename, char *features,
/* Compatibility syntax: */
if (featurestr[0] == '+') {
- add_flagname_to_bitmaps(featurestr + 1, plus_features, &local_err);
+ plus_features = g_list_append(plus_features,
+ g_strdup(featurestr + 1));
continue;
} else if (featurestr[0] == '-') {
- add_flagname_to_bitmaps(featurestr + 1, minus_features, &local_err);
+ minus_features = g_list_append(minus_features,
+ g_strdup(featurestr + 1));
continue;
}
Since removes the only assignments to local_err other than its
initialization to null, it can't become non-null anymore. Coverity
points out:
*** CID 1365201: Possible Control flow issues (DEADCODE)
/target-i386/cpu.c: 2050 in x86_cpu_parse_featurestr()
2044 prop->value = g_strdup(val);
2045 prop->errp = &error_fatal;
2046 qdev_prop_register_global(prop);
2047 }
2048
2049 if (local_err) {
>> CID 1365201: Possible Control flow issues (DEADCODE)
>> Execution cannot reach this statement: "error_propagate(errp,
local...".
2050 error_propagate(errp, local_err);
2051 }
2052 }
2053
2054 static void x86_cpu_load_features(X86CPU *cpu, Error **errp);
2055 static int x86_cpu_filter_features(X86CPU *cpu);
[...]
Please clean this up.