DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: stable@dpdk.org, Kai Ji <kai.ji@intel.com>,
	Fan Zhang <fanzhang.oss@gmail.com>,
	Ashish Gupta <ashishg@marvell.com>,
	Brian Dooley <brian.dooley@intel.com>,
	Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
Subject: [PATCH 3/7] drivers: fix some const pointers in qat drivers
Date: Fri, 28 Nov 2025 14:56:11 +0100	[thread overview]
Message-ID: <20251128135616.2662164-4-david.marchand@redhat.com> (raw)
In-Reply-To: <20251128135616.2662164-1-david.marchand@redhat.com>

With latest glibc (Fedora Rawhide):
../drivers/common/qat/qat_device.c: In function 'qat_dev_cmdline_get_val':
../drivers/common/qat/qat_device.c:183:43: warning: return discards 'const'
	qualifier from pointer target type [-Wdiscarded-qualifiers]
  183 |         return key ? strchr(key, '=') + 1 : NULL;
      |                                           ^
../drivers/common/qat/qat_device.c: In function 'cmdline_validate':
../drivers/common/qat/qat_device.c:189:25: warning: initialization discards
	'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  189 |         char *eq_sign = strchr(arg, '=');
      |                         ^~~~~~

Fixes: 99ab2806687b ("common/qat: isolate parser arguments configuration")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/common/qat/qat_device.c     | 7 ++++---
 drivers/common/qat/qat_device.h     | 2 +-
 drivers/compress/qat/qat_comp_pmd.c | 2 +-
 drivers/crypto/qat/qat_asym.c       | 2 +-
 drivers/crypto/qat/qat_sym.c        | 2 +-
 5 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/common/qat/qat_device.c b/drivers/common/qat/qat_device.c
index b582e3bf8b..07a8b19583 100644
--- a/drivers/common/qat/qat_device.c
+++ b/drivers/common/qat/qat_device.c
@@ -173,7 +173,7 @@ wireless_slice_support(uint16_t pci_dev_id)
  * other than the equals sign is ignored. It will not work with other conversion
  * functions like strt*.
  */
-char *qat_dev_cmdline_get_val(struct qat_pci_device *qat_dev,
+const char *qat_dev_cmdline_get_val(struct qat_pci_device *qat_dev,
 	const char *key)
 {
 	if (qat_dev->command_line == NULL)
@@ -185,8 +185,9 @@ char *qat_dev_cmdline_get_val(struct qat_pci_device *qat_dev,
 
 static int cmdline_validate(const char *arg)
 {
+	const char *eq_sign = strchr(arg, '=');
 	int i, len;
-	char *eq_sign = strchr(arg, '=');
+
 	/* Check for the equal sign */
 	if (eq_sign == NULL) {
 		QAT_LOG(ERR, "malformed string, no equals sign, %s", arg);
@@ -263,7 +264,7 @@ qat_pci_device_allocate(struct rte_pci_device *pci_dev)
 	struct rte_mem_resource *mem_resource;
 	const struct rte_memzone *qat_dev_mz;
 	int qat_dev_size, extra_size;
-	char *cmdline = NULL;
+	const char *cmdline = NULL;
 
 	rte_pci_device_name(&pci_dev->addr, name, sizeof(name));
 	snprintf(name+strlen(name), QAT_DEV_NAME_MAX_LEN-strlen(name), "_qat");
diff --git a/drivers/common/qat/qat_device.h b/drivers/common/qat/qat_device.h
index f5ba1592c3..34937e963e 100644
--- a/drivers/common/qat/qat_device.h
+++ b/drivers/common/qat/qat_device.h
@@ -42,7 +42,7 @@ typedef int (*qat_dev_get_extra_size_t)(void);
 typedef int (*qat_dev_get_slice_map_t)(uint32_t *map,
 		const struct rte_pci_device *pci_dev);
 
-char *qat_dev_cmdline_get_val(struct qat_pci_device *qat_dev, const char *key);
+const char *qat_dev_cmdline_get_val(struct qat_pci_device *qat_dev, const char *key);
 
 struct qat_dev_hw_spec_funcs {
 	qat_dev_reset_ring_pairs_t	qat_dev_reset_ring_pairs;
diff --git a/drivers/compress/qat/qat_comp_pmd.c b/drivers/compress/qat/qat_comp_pmd.c
index 55e510c91f..92dac79423 100644
--- a/drivers/compress/qat/qat_comp_pmd.c
+++ b/drivers/compress/qat/qat_comp_pmd.c
@@ -690,7 +690,7 @@ qat_comp_dev_create(struct qat_pci_device *qat_pci_dev)
 			&qat_comp_gen_dev_ops[qat_pci_dev->qat_dev_gen];
 	uint64_t capa_size;
 	uint16_t sub_id = qat_dev_instance->pci_dev->id.subsystem_device_id;
-	char *cmdline = NULL;
+	const char *cmdline = NULL;
 
 	snprintf(name, RTE_COMPRESSDEV_NAME_MAX_LEN, "%s_%s",
 			qat_pci_dev->name, "comp");
diff --git a/drivers/crypto/qat/qat_asym.c b/drivers/crypto/qat/qat_asym.c
index 8808337551..06f037cc14 100644
--- a/drivers/crypto/qat/qat_asym.c
+++ b/drivers/crypto/qat/qat_asym.c
@@ -1697,7 +1697,7 @@ qat_asym_dev_create(struct qat_pci_device *qat_pci_dev)
 	char name[RTE_CRYPTODEV_NAME_MAX_LEN];
 	char capa_memz_name[RTE_CRYPTODEV_NAME_MAX_LEN];
 	uint16_t sub_id = qat_dev_instance->pci_dev->id.subsystem_device_id;
-	char *cmdline = NULL;
+	const char *cmdline = NULL;
 
 	snprintf(name, RTE_CRYPTODEV_NAME_MAX_LEN, "%s_%s",
 			qat_pci_dev->name, "asym");
diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c
index d979ae6489..83f1084030 100644
--- a/drivers/crypto/qat/qat_sym.c
+++ b/drivers/crypto/qat/qat_sym.c
@@ -217,7 +217,7 @@ qat_sym_dev_create(struct qat_pci_device *qat_pci_dev)
 	const struct qat_crypto_gen_dev_ops *gen_dev_ops =
 		&qat_sym_gen_dev_ops[qat_pci_dev->qat_dev_gen];
 	uint16_t sub_id = qat_dev_instance->pci_dev->id.subsystem_device_id;
-	char *cmdline = NULL;
+	const char *cmdline = NULL;
 
 	snprintf(name, RTE_CRYPTODEV_NAME_MAX_LEN, "%s_%s",
 			qat_pci_dev->name, "sym");
-- 
2.51.1


  parent reply	other threads:[~2025-11-28 13:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-28 13:56 [PATCH 0/7] Fixes for Fedora Rawhide David Marchand
2025-11-28 13:56 ` [PATCH 1/7] bus/ifpga: fix const pointer in device name parsing David Marchand
2025-11-28 13:56 ` [PATCH 2/7] bus/uacce: fix const pointer in device matching David Marchand
2025-11-28 13:56 ` David Marchand [this message]
2025-11-28 13:56 ` [PATCH 4/7] crypto/caam_jr: fix const pointer in UIO filename parsing David Marchand
2025-11-28 14:00   ` Hemant Agrawal
2025-11-28 13:56 ` [PATCH 5/7] net/enetfec: " David Marchand
2025-11-28 14:00   ` Hemant Agrawal
2025-11-28 13:56 ` [PATCH 6/7] net/memif: fix const pointer in socket check David Marchand
2025-11-28 13:56 ` [PATCH 7/7] app/procinfo: fix const pointer in collectd format David Marchand

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=20251128135616.2662164-4-david.marchand@redhat.com \
    --to=david.marchand@redhat.com \
    --cc=arkadiuszx.kusztal@intel.com \
    --cc=ashishg@marvell.com \
    --cc=brian.dooley@intel.com \
    --cc=dev@dpdk.org \
    --cc=fanzhang.oss@gmail.com \
    --cc=kai.ji@intel.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;
as well as URLs for NNTP newsgroup(s).