[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 03/14] hw/ppc/spapr_caps.c: use g_autofree in spapr_cap_set_s
From: |
David Gibson |
Subject: |
Re: [PATCH 03/14] hw/ppc/spapr_caps.c: use g_autofree in spapr_cap_set_string() |
Date: |
Tue, 1 Mar 2022 14:14:50 +1100 |
On Mon, Feb 28, 2022 at 02:49:53PM -0300, Daniel Henrique Barboza wrote:
> And get rid of the 'out' label since it's now used.
s/used/unused/
>
> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> ---
> hw/ppc/spapr_caps.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c
> index 6167431271..aab313ffb1 100644
> --- a/hw/ppc/spapr_caps.c
> +++ b/hw/ppc/spapr_caps.c
> @@ -120,7 +120,7 @@ static void spapr_cap_set_string(Object *obj, Visitor *v,
> const char *name,
> SpaprCapabilityInfo *cap = opaque;
> SpaprMachineState *spapr = SPAPR_MACHINE(obj);
> uint8_t i;
> - char *val;
> + g_autofree char *val = NULL;
>
> if (!visit_type_str(v, name, &val, errp)) {
> return;
> @@ -128,20 +128,18 @@ static void spapr_cap_set_string(Object *obj, Visitor
> *v, const char *name,
>
> if (!strcmp(val, "?")) {
> error_setg(errp, "%s", cap->possible->help);
> - goto out;
> + return;
> }
> for (i = 0; i < cap->possible->num; i++) {
> if (!strcasecmp(val, cap->possible->vals[i])) {
> spapr->cmd_line_caps[cap->index] = true;
> spapr->eff.caps[cap->index] = i;
> - goto out;
> + return;
> }
> }
>
> error_setg(errp, "Invalid capability mode \"%s\" for cap-%s", val,
> cap->name);
> -out:
> - g_free(val);
> }
>
> static void spapr_cap_get_pagesize(Object *obj, Visitor *v, const char *name,
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
signature.asc
Description: PGP signature
- [PATCH 00/14] simple cleanups in spapr files, Daniel Henrique Barboza, 2022/02/28
- [PATCH 01/14] hw/ppc/spapr.c: use g_autofree in spapr_dt_chosen(), Daniel Henrique Barboza, 2022/02/28
- [PATCH 02/14] hw/ppc/spapr.c: fail early if no firmware found in machine_init(), Daniel Henrique Barboza, 2022/02/28
- [PATCH 03/14] hw/ppc/spapr_caps.c: use g_autofree in spapr_cap_set_string(), Daniel Henrique Barboza, 2022/02/28
- Re: [PATCH 03/14] hw/ppc/spapr_caps.c: use g_autofree in spapr_cap_set_string(),
David Gibson <=
- [PATCH 04/14] hw/ppc/spapr_caps.c: use g_autofree in spapr_cap_get_string(), Daniel Henrique Barboza, 2022/02/28
- [PATCH 05/14] hw/ppc/spapr_caps.c: use g_autofree in spapr_caps_add_properties(), Daniel Henrique Barboza, 2022/02/28
- [PATCH 06/14] hw/ppc/spapr_drc.c: use g_auto in spapr_dt_drc(), Daniel Henrique Barboza, 2022/02/28
- [PATCH 07/14] hw/ppc/spapr_drc.c: use g_autofree in drc_realize(), Daniel Henrique Barboza, 2022/02/28
- [PATCH 08/14] hw/ppc/spapr_drc.c: use g_autofree in drc_unrealize(), Daniel Henrique Barboza, 2022/02/28
- [PATCH 09/14] hw/ppc/spapr_drc.c: use g_autofree in spapr_dr_connector_new(), Daniel Henrique Barboza, 2022/02/28
- [PATCH 10/14] hw/ppc/spapr_drc.c: use g_autofree in spapr_drc_by_index(), Daniel Henrique Barboza, 2022/02/28
- [PATCH 13/14] hw/ppc/spapr_rtas.c: use g_autofree in rtas_ibm_get_system_parameter(), Daniel Henrique Barboza, 2022/02/28