[Accel-config] Re: [PATCH] accel-config: Fix a bug in list command

Dave Jiang <dave.jiang at intel.com> Fri, 30 Jul 2021 10:16:09 -0700
Newsgroups dev.linux.lists.accel-config
Message-ID <[email protected]>
On 7/29/2021 7:22 PM, ramesh.thomas(a)intel.com wrote:
> From: Ramesh Thomas <ramesh.thomas(a)intel.com>
>
> The check for ACCFG_DEVICE_IAX to avoid reading some dsa device specific
> attributes was misplaced. It excluded lines that should be included while
> included reading of traffic_class_a which should be read even for iax
> devices.
>
> Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>

Reviewed-by: Dave Jiang <dave.jiang(a)intel.com>


> ---
>   accfg/list.c | 16 +++++++++-------
>   1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/accfg/list.c b/accfg/list.c
> index d03cf30..7fec813 100644
> --- a/accfg/list.c
> +++ b/accfg/list.c
> @@ -66,11 +66,12 @@ static struct json_object *group_to_json(struct accfg_group *group,
>   		goto err;
>   
>   	json_object_object_add(jgroup, "dev", jobj);
> -	jobj = json_object_new_int(accfg_group_get_tokens_reserved(group));
> -	if (!jobj)
> -		goto err;
>   
>   	if (accfg_device_get_type(dev) != ACCFG_DEVICE_IAX) {
> +		jobj = json_object_new_int(accfg_group_get_tokens_reserved(group));
> +		if (!jobj)
> +			goto err;
> +
>   		json_object_object_add(jgroup, "tokens_reserved", jobj);
>   		jobj = json_object_new_int(accfg_group_get_use_token_limit(group));
>   		if (!jobj)
> @@ -82,12 +83,13 @@ static struct json_object *group_to_json(struct accfg_group *group,
>   			goto err;
>   
>   		json_object_object_add(jgroup, "tokens_allowed", jobj);
> -		jobj = json_object_new_int(accfg_group_get_traffic_class_a(
> -				group));
> -		if (!jobj)
> -			goto err;
>   	}
>   
> +	jobj = json_object_new_int(accfg_group_get_traffic_class_a(
> +				group));
> +	if (!jobj)
> +		goto err;
> +
>   	json_object_object_add(jgroup, "traffic_class_a", jobj);
>   	jobj = json_object_new_int(accfg_group_get_traffic_class_b(
>   				group));