|SUCCESS| examples/vm_power_manager: fix const discarding

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Wed Apr 1 21:41:17 CEST 2026


Test-Label: ai-code-review
Test-Status: SUCCESS
https://dpdk.org/patch/162807

_AI Code Review_

=== Patch Review: series.patch (via Claude) ===
Review date: 2026-04-01

commit: [To be determined from patch metadata]
Author: Thomas Monjalon <thomas at monjalon.net>
Subject: [PATCH] examples/vm_power_manager: fix const discarding

This patch removes the wrapper function get_resource_name_from_chn_path()
and replaces it with a direct call to strstr(), fixing a const qualifier
warning in GCC 15.2.1.

> diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c
> index 800f733a26..3023e444a4 100644
> --- a/examples/vm_power_manager/channel_monitor.c
> +++ b/examples/vm_power_manager/channel_monitor.c
> @@ -131,16 +131,6 @@ set_policy_mac(struct rte_power_channel_packet *pkt, int idx, char *mac)
>  	return 0;
>  }
>  
> -static char*
> -get_resource_name_from_chn_path(const char *channel_path)
> -{
> -	char *substr = NULL;
> -
> -	substr = strstr(channel_path, CHANNEL_MGR_FIFO_PATTERN_NAME);
> -
> -	return substr;
> -}
> -

The function being removed returned a non-const char* pointer from
strstr() which was called with a const char* argument. This discarded
the const qualifier. The removal is correct.

[ ... ]

> @@ -1066,8 +1056,8 @@ read_json_packet(struct channel_info *chan_info)
>  		root = json_loads(json_data, 0, &error);
>  
>  		if (root) {
> -			resource_name = get_resource_name_from_chn_path(
> -				chan_info->channel_path);
> +			resource_name = strstr(chan_info->channel_path,
> +					CHANNEL_MGR_FIFO_PATTERN_NAME);

Does the variable resource_name have the correct type (const char*) to
receive the result from strstr()? If resource_name is declared as char*
instead of const char*, this change would move the const-discarding
issue to a different location rather than fixing it.

Can you verify the declaration of resource_name in read_json_packet()?


More information about the test-report mailing list