Skip to content

Commit a816f2d

Browse files
gkurzdgibson
authored andcommitted
spapr: Simplify some warning printing paths in spapr_caps.c
We obviously only want to print a warning in these cases, but this is done in a rather convoluted manner. Just use warn_report() instead. Signed-off-by: Greg Kurz <[email protected]> Message-Id: <[email protected]> Reviewed-by: Vladimir Sementsov-Ogievskiy <[email protected]> Reviewed-by: Laurent Vivier <[email protected]> Signed-off-by: David Gibson <[email protected]>
1 parent 63d2119 commit a816f2d

File tree

1 file changed

+6
-22
lines changed

1 file changed

+6
-22
lines changed

hw/ppc/spapr_caps.c

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -248,23 +248,18 @@ SpaprCapPossible cap_cfpc_possible = {
248248
static void cap_safe_cache_apply(SpaprMachineState *spapr, uint8_t val,
249249
Error **errp)
250250
{
251-
Error *local_err = NULL;
252251
uint8_t kvm_val = kvmppc_get_cap_safe_cache();
253252

254253
if (tcg_enabled() && val) {
255254
/* TCG only supports broken, allow other values and print a warning */
256-
error_setg(&local_err,
257-
"TCG doesn't support requested feature, cap-cfpc=%s",
258-
cap_cfpc_possible.vals[val]);
255+
warn_report("TCG doesn't support requested feature, cap-cfpc=%s",
256+
cap_cfpc_possible.vals[val]);
259257
} else if (kvm_enabled() && (val > kvm_val)) {
260258
error_setg(errp,
261259
"Requested safe cache capability level not supported by kvm,"
262260
" try appending -machine cap-cfpc=%s",
263261
cap_cfpc_possible.vals[kvm_val]);
264262
}
265-
266-
if (local_err != NULL)
267-
warn_report_err(local_err);
268263
}
269264

270265
SpaprCapPossible cap_sbbc_possible = {
@@ -277,23 +272,18 @@ SpaprCapPossible cap_sbbc_possible = {
277272
static void cap_safe_bounds_check_apply(SpaprMachineState *spapr, uint8_t val,
278273
Error **errp)
279274
{
280-
Error *local_err = NULL;
281275
uint8_t kvm_val = kvmppc_get_cap_safe_bounds_check();
282276

283277
if (tcg_enabled() && val) {
284278
/* TCG only supports broken, allow other values and print a warning */
285-
error_setg(&local_err,
286-
"TCG doesn't support requested feature, cap-sbbc=%s",
287-
cap_sbbc_possible.vals[val]);
279+
warn_report("TCG doesn't support requested feature, cap-sbbc=%s",
280+
cap_sbbc_possible.vals[val]);
288281
} else if (kvm_enabled() && (val > kvm_val)) {
289282
error_setg(errp,
290283
"Requested safe bounds check capability level not supported by kvm,"
291284
" try appending -machine cap-sbbc=%s",
292285
cap_sbbc_possible.vals[kvm_val]);
293286
}
294-
295-
if (local_err != NULL)
296-
warn_report_err(local_err);
297287
}
298288

299289
SpaprCapPossible cap_ibs_possible = {
@@ -309,24 +299,18 @@ SpaprCapPossible cap_ibs_possible = {
309299
static void cap_safe_indirect_branch_apply(SpaprMachineState *spapr,
310300
uint8_t val, Error **errp)
311301
{
312-
Error *local_err = NULL;
313302
uint8_t kvm_val = kvmppc_get_cap_safe_indirect_branch();
314303

315304
if (tcg_enabled() && val) {
316305
/* TCG only supports broken, allow other values and print a warning */
317-
error_setg(&local_err,
318-
"TCG doesn't support requested feature, cap-ibs=%s",
319-
cap_ibs_possible.vals[val]);
306+
warn_report("TCG doesn't support requested feature, cap-ibs=%s",
307+
cap_ibs_possible.vals[val]);
320308
} else if (kvm_enabled() && (val > kvm_val)) {
321309
error_setg(errp,
322310
"Requested safe indirect branch capability level not supported by kvm,"
323311
" try appending -machine cap-ibs=%s",
324312
cap_ibs_possible.vals[kvm_val]);
325313
}
326-
327-
if (local_err != NULL) {
328-
warn_report_err(local_err);
329-
}
330314
}
331315

332316
#define VALUE_DESC_TRISTATE " (broken, workaround, fixed)"

0 commit comments

Comments
 (0)