[PATCH] staging: media: atomisp: fix variable shadowing warnings

Rhys Tumelty posted 1 patch 2 weeks, 4 days ago
.../media/atomisp/pci/atomisp_compat_css20.c       |  6 +++---
drivers/staging/media/atomisp/pci/sh_css.c         | 14 +++++++-------
2 files changed, 10 insertions(+), 10 deletions(-)
[PATCH] staging: media: atomisp: fix variable shadowing warnings
Posted by Rhys Tumelty 2 weeks, 4 days ago
Fix local variable shadowing warnings, flagged by a W=2
kernel build, due to -Werror=shadow.

In atomisp_css_stop(), an inner loop 'i' index shadows
an outer unsigned int i. Rename the inner loop index to 'k'

In ia_css_stream_create(), the block-local 'effective_res'
struct shadows an outer local declaration. Rename the
block scoped instance in the loop over pipes to
'pipe_effective_res' to clearly show context.

Signed-off-by: Rhys Tumelty <rhys@tumelty.co.uk>
---
 .../media/atomisp/pci/atomisp_compat_css20.c       |  6 +++---
 drivers/staging/media/atomisp/pci/sh_css.c         | 14 +++++++-------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
index be5f37f4a6fd..da945fddb5ea 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
@@ -1775,10 +1775,10 @@ void atomisp_css_stop(struct atomisp_sub_device *asd, bool in_reset)
 
 	if (!in_reset) {
 		struct atomisp_stream_env *stream_env;
-		int i, j;
+		int k, j;
 
-		for (i = 0; i < ATOMISP_INPUT_STREAM_NUM; i++) {
-			stream_env = &asd->stream_env[i];
+		for (k = 0; k < ATOMISP_INPUT_STREAM_NUM; k++) {
+			stream_env = &asd->stream_env[k];
 			for (j = 0; j < IA_CSS_PIPE_ID_NUM; j++) {
 				ia_css_pipe_config_defaults(
 				    &stream_env->pipe_configs[j]);
diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c
index cd1be313c758..44c77179abb8 100644
--- a/drivers/staging/media/atomisp/pci/sh_css.c
+++ b/drivers/staging/media/atomisp/pci/sh_css.c
@@ -7971,22 +7971,22 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config,
 	}
 
 	for (i = 0; i < num_pipes; i++) {
-		struct ia_css_resolution effective_res;
+		struct ia_css_resolution pipe_effective_res;
 
 		curr_pipe = pipes[i];
 		/* set current stream */
 		curr_pipe->stream = curr_stream;
 		/* take over effective info */
 
-		effective_res = curr_pipe->config.input_effective_res;
-		if (effective_res.height == 0 || effective_res.width == 0) {
-			effective_res = curr_pipe->stream->config.input_config.effective_res;
+		pipe_effective_res = curr_pipe->config.input_effective_res;
+		if (pipe_effective_res.height == 0 || pipe_effective_res.width == 0) {
+			pipe_effective_res = curr_pipe->stream->config.input_config.effective_res;
 
-			curr_pipe->config.input_effective_res = effective_res;
+			curr_pipe->config.input_effective_res = pipe_effective_res;
 		}
 		IA_CSS_LOG("effective_res=%dx%d",
-			   effective_res.width,
-			   effective_res.height);
+			   pipe_effective_res.width,
+			   pipe_effective_res.height);
 	}
 
 	err = ia_css_stream_isp_parameters_init(curr_stream);
-- 
2.54.0
Re: [PATCH] staging: media: atomisp: fix variable shadowing warnings
Posted by Andy Shevchenko 2 weeks, 4 days ago
On Mon, Jun 8, 2026 at 6:16 PM Rhys Tumelty <rhys@tumelty.co.uk> wrote:
>
> Fix local variable shadowing warnings, flagged by a W=2
> kernel build, due to -Werror=shadow.
>
> In atomisp_css_stop(), an inner loop 'i' index shadows
> an outer unsigned int i. Rename the inner loop index to 'k'
>
> In ia_css_stream_create(), the block-local 'effective_res'
> struct shadows an outer local declaration. Rename the
> block scoped instance in the loop over pipes to
> 'pipe_effective_res' to clearly show context.

Before even looking towards (some of) the W=2 warnings, please pay
attention to the real issues the driver has.

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH] media: atomisp: Fix local variable shadowing warnings
Posted by Rhys Tumelty 2 weeks, 3 days ago
On Tue, Jun 9, 2026 at 11:42 AM Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> Before even looking towards (some of) the W=2 warnings, please pay
> attention to the real issues the driver has.

Thanks for the feedback. I'm quite new to kernel development,
and I'm mainly just trying to get my footing on sending in
patches, currently starting with W=2. I'll have a look
at the TODOs or any known bugs to see if there are any minor
issues I can trust myself to help with.

Best regards,
Rhys