From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: stable@dpdk.org, Anatoly Burakov <anatoly.burakov@intel.com>,
Sivaprasad Tummala <sivaprasad.tummala@amd.com>,
Marcin Hajkowski <marcinx.hajkowski@intel.com>,
Lukasz Krakowiak <lukaszx.krakowiak@intel.com>,
Lukasz Gosiewski <lukaszx.gosiewski@intel.com>
Subject: [PATCH] examples/vm_power_manager: fix const discarding
Date: Wed, 1 Apr 2026 11:35:01 +0200 [thread overview]
Message-ID: <20260401093502.1420779-1-thomas@monjalon.net> (raw)
When compiling with GCC 15.2.1, a const qualifier issue
is seen with this warning:
In function 'get_resource_name_from_chn_path':
examples/vm_power_manager/channel_monitor.c:139:16:
error: assignment discards 'const' qualifier from pointer target type
139 | substr = strstr(channel_path, CHANNEL_MGR_FIFO_PATTERN_NAME);
| ^
The function get_resource_name_from_chn_path is used only once
and call a single function (strstr),
so it can be replaced with a direct call to strstr().
Fixes: 221e7026d521 ("examples/power: add FIFO per core for JSON interface")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
examples/vm_power_manager/channel_monitor.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
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;
-}
-
static int
get_resource_id_from_vmname(const char *vm_name)
{
@@ -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);
/*
* Because our data is now in the json
* object, we can overwrite the pkt
--
2.53.0
next reply other threads:[~2026-04-01 9:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-01 9:35 Thomas Monjalon [this message]
2026-04-08 18:18 ` [PATCH] examples/vm_power_manager: fix const discarding Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260401093502.1420779-1-thomas@monjalon.net \
--to=thomas@monjalon.net \
--cc=anatoly.burakov@intel.com \
--cc=dev@dpdk.org \
--cc=lukaszx.gosiewski@intel.com \
--cc=lukaszx.krakowiak@intel.com \
--cc=marcinx.hajkowski@intel.com \
--cc=sivaprasad.tummala@amd.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox