public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
* [PATCH] bus/fslmc: fix shadowed variables in queue storage macros
@ 2026-04-04 17:19 Weijun Pan
  2026-04-06  5:05 ` Hemant Agrawal
  2026-04-07 14:09 ` Stephen Hemminger
  0 siblings, 2 replies; 4+ messages in thread
From: Weijun Pan @ 2026-04-04 17:19 UTC (permalink / raw)
  To: Hemant Agrawal, Sachin Saxena, Jun Yang; +Cc: dev, Weijun Pan, stable

The queue storage allocation and free macros declare local variables
named ret and i, which shadow local variables in
rte_dpaa2_create_dpci_device() and trigger -Wshadow warnings.

Rename the macro-local variables to avoid shadowing without changing
behavior.

Bugzilla ID: 1744
Fixes: 12d98eceb8ac ("bus/fslmc: enhance QBMAN DQ storage logic")
Cc: jun.yang@nxp.com
Cc: stable@dpdk.org

Signed-off-by: Weijun Pan <wpan36@wisc.edu>
---
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 28 ++++++++++++-------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index e625a5c035..bbeccd8fc3 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -204,33 +204,33 @@ struct swp_active_dqs {
 
 #define dpaa2_queue_storage_alloc(q, num) \
 ({ \
-	int ret = 0, i; \
+	int qs_ret = 0, qs_idx; \
 	\
-	for (i = 0; i < (num); i++) { \
-		(q)->q_storage[i] = rte_zmalloc(NULL, \
+	for (qs_idx = 0; qs_idx < (num); qs_idx++) { \
+		(q)->q_storage[qs_idx] = rte_zmalloc(NULL, \
 			sizeof(struct queue_storage_info_t), \
 			RTE_CACHE_LINE_SIZE); \
-		if (!(q)->q_storage[i]) { \
-			ret = -ENOBUFS; \
+		if (!(q)->q_storage[qs_idx]) { \
+			qs_ret = -ENOBUFS; \
 			break; \
 		} \
-		ret = dpaa2_alloc_dq_storage((q)->q_storage[i]); \
-		if (ret) \
+		qs_ret = dpaa2_alloc_dq_storage((q)->q_storage[qs_idx]); \
+		if (qs_ret) \
 			break; \
 	} \
-	ret; \
+	qs_ret; \
 })
 
 #define dpaa2_queue_storage_free(q, num) \
 ({ \
 	if (q) { \
-		int i; \
+		int qs_idx; \
 		\
-		for (i = 0; i < (num); i++) { \
-			if ((q)->q_storage[i]) { \
-				dpaa2_free_dq_storage((q)->q_storage[i]); \
-				rte_free((q)->q_storage[i]); \
-				(q)->q_storage[i] = NULL; \
+		for (qs_idx = 0; qs_idx < (num); qs_idx++) { \
+			if ((q)->q_storage[qs_idx]) { \
+				dpaa2_free_dq_storage((q)->q_storage[qs_idx]); \
+				rte_free((q)->q_storage[qs_idx]); \
+				(q)->q_storage[qs_idx] = NULL; \
 			} \
 		} \
 	} \
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH] bus/fslmc: fix shadowed variables in queue storage macros
  2026-04-04 17:19 [PATCH] bus/fslmc: fix shadowed variables in queue storage macros Weijun Pan
@ 2026-04-06  5:05 ` Hemant Agrawal
  2026-04-07 14:09 ` Stephen Hemminger
  1 sibling, 0 replies; 4+ messages in thread
From: Hemant Agrawal @ 2026-04-06  5:05 UTC (permalink / raw)
  To: Weijun Pan, Sachin Saxena, Jun Yang
  Cc: dev@dpdk.org, Weijun Pan, stable@dpdk.org


Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] bus/fslmc: fix shadowed variables in queue storage macros
  2026-04-04 17:19 [PATCH] bus/fslmc: fix shadowed variables in queue storage macros Weijun Pan
  2026-04-06  5:05 ` Hemant Agrawal
@ 2026-04-07 14:09 ` Stephen Hemminger
  1 sibling, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2026-04-07 14:09 UTC (permalink / raw)
  To: Weijun Pan
  Cc: Hemant Agrawal, Sachin Saxena, Jun Yang, dev, Weijun Pan, stable

On Sat,  4 Apr 2026 12:19:11 -0500
Weijun Pan <wpan3636@gmail.com> wrote:

> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
> index e625a5c035..bbeccd8fc3 100644
> --- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
> +++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
> @@ -204,33 +204,33 @@ struct swp_active_dqs {
>  
>  #define dpaa2_queue_storage_alloc(q, num) \
>  ({ \
> -	int ret = 0, i; \
> +	int qs_ret = 0, qs_idx; \
>  	\
> -	for (i = 0; i < (num); i++) { \
> -		(q)->q_storage[i] = rte_zmalloc(NULL, \
> +	for (qs_idx = 0; qs_idx < (num); qs_idx++) { \
> +		(q)->q_storage[qs_idx] = rte_zmalloc(NULL, \
>  			sizeof(struct queue_storage_info_t), \
>  			RTE_CACHE_LINE_SIZE); \
> -		if (!(q)->q_storage[i]) { \
> -			ret = -ENOBUFS; \
> +		if (!(q)->q_storage[qs_idx]) { \
> +			qs_ret = -ENOBUFS; \
>  			break; \
>  		} \
> -		ret = dpaa2_alloc_dq_storage((q)->q_storage[i]); \
> -		if (ret) \
> +		qs_ret = dpaa2_alloc_dq_storage((q)->q_storage[qs_idx]); \
> +		if (qs_ret) \
>  			break; \
>  	} \
> -	ret; \
> +	qs_ret; \
>  })
>  
>  #define dpaa2_queue_storage_free(q, num) \
>  ({ \
>  	if (q) { \
> -		int i; \
> +		int qs_idx; \
>  		\
> -		for (i = 0; i < (num); i++) { \
> -			if ((q)->q_storage[i]) { \
> -				dpaa2_free_dq_storage((q)->q_storage[i]); \
> -				rte_free((q)->q_storage[i]); \
> -				(q)->q_storage[i] = NULL; \
> +		for (qs_idx = 0; qs_idx < (num); qs_idx++) { \
> +			if ((q)->q_storage[qs_idx]) { \
> +				dpaa2_free_dq_storage((q)->q_storage[qs_idx]); \
> +				rte_free((q)->q_storage[qs_idx]); \
> +				(q)->q_storage[qs_idx] = NULL; \
>  			} \
>  		} \
>  	} \


Why are these not inline functions.
Macros with lower case names are likely place fore confusion like this?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] bus/fslmc: fix shadowed variables in queue storage macros
@ 2026-04-07 14:19 Weijun Pan
  0 siblings, 0 replies; 4+ messages in thread
From: Weijun Pan @ 2026-04-07 14:19 UTC (permalink / raw)
  To: Hemant Agrawal, Sachin Saxena, Jun Yang; +Cc: dev, Weijun Pan, stable

The queue storage allocation and free macros declare local variables
named ret and i, which shadow local variables in
rte_dpaa2_create_dpci_device() and trigger -Wshadow warnings.

Rename the macro-local variables to avoid shadowing without changing
behavior.

Bugzilla ID: 1744
Fixes: 12d98eceb8ac ("bus/fslmc: enhance QBMAN DQ storage logic")
Cc: jun.yang@nxp.com
Cc: stable@dpdk.org

Signed-off-by: Weijun Pan <wpan36@wisc.edu>
---
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 28 ++++++++++++-------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index e625a5c035..bbeccd8fc3 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -204,33 +204,33 @@ struct swp_active_dqs {
 
 #define dpaa2_queue_storage_alloc(q, num) \
 ({ \
-	int ret = 0, i; \
+	int qs_ret = 0, qs_idx; \
 	\
-	for (i = 0; i < (num); i++) { \
-		(q)->q_storage[i] = rte_zmalloc(NULL, \
+	for (qs_idx = 0; qs_idx < (num); qs_idx++) { \
+		(q)->q_storage[qs_idx] = rte_zmalloc(NULL, \
 			sizeof(struct queue_storage_info_t), \
 			RTE_CACHE_LINE_SIZE); \
-		if (!(q)->q_storage[i]) { \
-			ret = -ENOBUFS; \
+		if (!(q)->q_storage[qs_idx]) { \
+			qs_ret = -ENOBUFS; \
 			break; \
 		} \
-		ret = dpaa2_alloc_dq_storage((q)->q_storage[i]); \
-		if (ret) \
+		qs_ret = dpaa2_alloc_dq_storage((q)->q_storage[qs_idx]); \
+		if (qs_ret) \
 			break; \
 	} \
-	ret; \
+	qs_ret; \
 })
 
 #define dpaa2_queue_storage_free(q, num) \
 ({ \
 	if (q) { \
-		int i; \
+		int qs_idx; \
 		\
-		for (i = 0; i < (num); i++) { \
-			if ((q)->q_storage[i]) { \
-				dpaa2_free_dq_storage((q)->q_storage[i]); \
-				rte_free((q)->q_storage[i]); \
-				(q)->q_storage[i] = NULL; \
+		for (qs_idx = 0; qs_idx < (num); qs_idx++) { \
+			if ((q)->q_storage[qs_idx]) { \
+				dpaa2_free_dq_storage((q)->q_storage[qs_idx]); \
+				rte_free((q)->q_storage[qs_idx]); \
+				(q)->q_storage[qs_idx] = NULL; \
 			} \
 		} \
 	} \
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-04-08  8:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-04 17:19 [PATCH] bus/fslmc: fix shadowed variables in queue storage macros Weijun Pan
2026-04-06  5:05 ` Hemant Agrawal
2026-04-07 14:09 ` Stephen Hemminger
  -- strict thread matches above, loose matches on Subject: below --
2026-04-07 14:19 Weijun Pan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox