raw/ioat: fix parameter shadow warning

Message ID 20210507172025.181720-1-kevin.laatz@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series raw/ioat: fix parameter shadow warning |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-testing success Testing PASS
ci/github-robot success github build: passed
ci/iol-abi-testing success Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-mellanox-Functional success Functional Testing PASS

Commit Message

Kevin Laatz May 7, 2021, 5:20 p.m. UTC
  In the function __idxd_completed_ops() we have a parameter shadow warning
due to a local variable having the same name as one of the function
parameters. This is fixed by simply renaming the local variable.

Fixes: 245efe544d8e ("raw/ioat: report status of completed jobs")

Reported-by: Sunil Pai G <sunil.pai.g@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
---
 drivers/raw/ioat/rte_idxd_rawdev_fns.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Sunil Pai G May 8, 2021, 7:25 a.m. UTC | #1
<snipped>

Tested-by: Sunil Pai G <sunil.pai.g@intel.com>
  
Bruce Richardson May 10, 2021, 9:02 a.m. UTC | #2
On Fri, May 07, 2021 at 05:20:25PM +0000, Kevin Laatz wrote:
> In the function __idxd_completed_ops() we have a parameter shadow warning
> due to a local variable having the same name as one of the function
> parameters. This is fixed by simply renaming the local variable.
> 
> Fixes: 245efe544d8e ("raw/ioat: report status of completed jobs")
> 
> Reported-by: Sunil Pai G <sunil.pai.g@intel.com>
> Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
> ---
Please provide details in the commit log as to how/when this was seen. I
believe this issue was seen only with OVS because it passes the -Wshadow
flag when building - something DPDK probably should do, but doesn't. Is
that correct?
  
Kevin Laatz May 10, 2021, 11:07 a.m. UTC | #3
> On Fri, May 07, 2021 at 05:20:25PM +0000, Kevin Laatz wrote:
> > In the function __idxd_completed_ops() we have a parameter shadow
> warning
> > due to a local variable having the same name as one of the function
> > parameters. This is fixed by simply renaming the local variable.
> >
> > Fixes: 245efe544d8e ("raw/ioat: report status of completed jobs")
> >
> > Reported-by: Sunil Pai G <sunil.pai.g@intel.com>
> > Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
> > ---
> Please provide details in the commit log as to how/when this was seen. I
> believe this issue was seen only with OVS because it passes the -Wshadow
> flag when building - something DPDK probably should do, but doesn't. Is
> that correct?

Correct, the OVS build has -Wshadow by default. When -Wshadow is
passed to the DPDK build, this warning is also visible.

Will send a V2 to include details in commit log.
  

Patch

diff --git a/drivers/raw/ioat/rte_idxd_rawdev_fns.h b/drivers/raw/ioat/rte_idxd_rawdev_fns.h
index 862e0eb41d..dbd8dfc507 100644
--- a/drivers/raw/ioat/rte_idxd_rawdev_fns.h
+++ b/drivers/raw/ioat/rte_idxd_rawdev_fns.h
@@ -301,11 +301,11 @@  __idxd_completed_ops(int dev_id, uint8_t max_ops, uint32_t *status, uint8_t *num
 		uint16_t idx_to_chk = idxd->batch_idx_ring[idxd->batch_idx_read];
 		volatile struct rte_idxd_completion *comp_to_chk =
 				(struct rte_idxd_completion *)&idxd->desc_ring[idx_to_chk];
-		uint8_t status = comp_to_chk->status;
-		if (status == 0)
+		uint8_t batch_status = comp_to_chk->status;
+		if (batch_status == 0)
 			break;
 		comp_to_chk->status = 0;
-		if (unlikely(status > 1)) {
+		if (unlikely(batch_status > 1)) {
 			/* error occurred somewhere in batch, start where last checked */
 			uint16_t desc_count = comp_to_chk->completed_size;
 			uint16_t batch_start = idxd->hdls_avail;