* [PATCH] staging: atomisp: Fix fallthrough keyword warning
@ 2020-08-31 13:30 Cengiz Can
2020-08-31 13:40 ` Dan Carpenter
2020-08-31 14:35 ` [PATCH] staging: atomisp: Fix fallthrough keyword warning Mauro Carvalho Chehab
0 siblings, 2 replies; 6+ messages in thread
From: Cengiz Can @ 2020-08-31 13:30 UTC (permalink / raw)
To: Gustavo A . R . Silva, Mauro Carvalho Chehab, Sakari Ailus,
Andy Shevchenko
Cc: linux-media, devel, linux-kernel, Cengiz Can
commit df561f6688fe ("treewide: Use fallthrough pseudo-keyword") from
Gustavo A. R. Silva replaced and standardized /* fallthrough */ comments
with 'fallthrough' pseudo-keyword.
However, in one of the switch-case statements, Coverity Static Analyzer
throws a warning that 'fallthrough' is unreachable due to the adjacent
'return false' statement.
Since 'fallthrough' is actually an empty "do {} while(0)" this might be
due to compiler optimizations. But that needs further investigation.
In order to fix the unreachable code warning, make adjacent 'return
false' a part of the previous if statement's else clause.
Reported-by: Coverity Static Analyzer CID 1466511
Signed-off-by: Cengiz Can <cengiz@kernel.wtf>
---
drivers/staging/media/atomisp/pci/atomisp_compat_css20.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
index 1b2b2c68025b..aaa2d0e0851b 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
@@ -709,8 +709,8 @@ static bool is_pipe_valid_to_current_run_mode(struct atomisp_sub_device *asd,
if (pipe_id == IA_CSS_PIPE_ID_CAPTURE ||
pipe_id == IA_CSS_PIPE_ID_PREVIEW)
return true;
-
- return false;
+ else
+ return false;
fallthrough;
case ATOMISP_RUN_MODE_VIDEO:
if (!asd->continuous_mode->val) {
--
2.28.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] staging: atomisp: Fix fallthrough keyword warning
2020-08-31 13:30 [PATCH] staging: atomisp: Fix fallthrough keyword warning Cengiz Can
@ 2020-08-31 13:40 ` Dan Carpenter
2020-08-31 13:45 ` Dan Carpenter
2020-08-31 13:51 ` [PATCH v2] staging: atomisp: Remove unnecessary 'fallthrough' Cengiz Can
2020-08-31 14:35 ` [PATCH] staging: atomisp: Fix fallthrough keyword warning Mauro Carvalho Chehab
1 sibling, 2 replies; 6+ messages in thread
From: Dan Carpenter @ 2020-08-31 13:40 UTC (permalink / raw)
To: Cengiz Can
Cc: Gustavo A . R . Silva, Mauro Carvalho Chehab, Sakari Ailus,
Andy Shevchenko, devel, linux-kernel, linux-media
On Mon, Aug 31, 2020 at 04:30:12PM +0300, Cengiz Can wrote:
> commit df561f6688fe ("treewide: Use fallthrough pseudo-keyword") from
> Gustavo A. R. Silva replaced and standardized /* fallthrough */ comments
> with 'fallthrough' pseudo-keyword.
>
> However, in one of the switch-case statements, Coverity Static Analyzer
> throws a warning that 'fallthrough' is unreachable due to the adjacent
> 'return false' statement.
>
> Since 'fallthrough' is actually an empty "do {} while(0)" this might be
> due to compiler optimizations. But that needs further investigation.
>
> In order to fix the unreachable code warning, make adjacent 'return
> false' a part of the previous if statement's else clause.
>
> Reported-by: Coverity Static Analyzer CID 1466511
> Signed-off-by: Cengiz Can <cengiz@kernel.wtf>
> ---
> drivers/staging/media/atomisp/pci/atomisp_compat_css20.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
> index 1b2b2c68025b..aaa2d0e0851b 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
> @@ -709,8 +709,8 @@ static bool is_pipe_valid_to_current_run_mode(struct atomisp_sub_device *asd,
> if (pipe_id == IA_CSS_PIPE_ID_CAPTURE ||
> pipe_id == IA_CSS_PIPE_ID_PREVIEW)
> return true;
> -
> - return false;
> + else
> + return false;
> fallthrough;
Heh... Still unreachable, but now it has a checkpatch.pl warning as
well. Just get rid of the bogus fallthrough annotation.
> case ATOMISP_RUN_MODE_VIDEO:
> if (!asd->continuous_mode->val) {
regards,
dan carpenter
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] staging: atomisp: Fix fallthrough keyword warning
2020-08-31 13:40 ` Dan Carpenter
@ 2020-08-31 13:45 ` Dan Carpenter
2020-08-31 13:51 ` [PATCH v2] staging: atomisp: Remove unnecessary 'fallthrough' Cengiz Can
1 sibling, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2020-08-31 13:45 UTC (permalink / raw)
To: Cengiz Can
Cc: devel, Mauro Carvalho Chehab, Gustavo A . R . Silva, linux-kernel,
Sakari Ailus, Andy Shevchenko, linux-media
Really I think this function is pretty buggy. It shouldn't be falling
through at all... I reported it a couple days back so it's possible
that someone is working on a fix already.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] staging: atomisp: Remove unnecessary 'fallthrough'
2020-08-31 13:40 ` Dan Carpenter
2020-08-31 13:45 ` Dan Carpenter
@ 2020-08-31 13:51 ` Cengiz Can
2020-08-31 14:28 ` Gustavo A. R. Silva
1 sibling, 1 reply; 6+ messages in thread
From: Cengiz Can @ 2020-08-31 13:51 UTC (permalink / raw)
To: dan.carpenter
Cc: andriy.shevchenko, cengiz, devel, gustavoars, linux-kernel,
linux-media, mchehab, sakari.ailus
commit df561f6688fe ("treewide: Use fallthrough pseudo-keyword") from
Gustavo A. R. Silva replaced and standardized /* fallthrough */ comments
with 'fallthrough' pseudo-keyword.
However, in one of the switch-case statements, Coverity Static Analyzer
throws a warning that 'fallthrough' is unreachable due to the adjacent
'return false' statement. (Coverity ID CID 1466511)
In order to fix the unreachable code warning, remove unnecessary
fallthrough keyword.
Signed-off-by: Cengiz Can <cengiz@kernel.wtf>
---
drivers/staging/media/atomisp/pci/atomisp_compat_css20.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
index 1b2b2c68025b..feb26c221e96 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
@@ -711,7 +711,6 @@ static bool is_pipe_valid_to_current_run_mode(struct atomisp_sub_device *asd,
return true;
return false;
- fallthrough;
case ATOMISP_RUN_MODE_VIDEO:
if (!asd->continuous_mode->val) {
if (pipe_id == IA_CSS_PIPE_ID_VIDEO ||
--
2.28.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] staging: atomisp: Remove unnecessary 'fallthrough'
2020-08-31 13:51 ` [PATCH v2] staging: atomisp: Remove unnecessary 'fallthrough' Cengiz Can
@ 2020-08-31 14:28 ` Gustavo A. R. Silva
0 siblings, 0 replies; 6+ messages in thread
From: Gustavo A. R. Silva @ 2020-08-31 14:28 UTC (permalink / raw)
To: Cengiz Can
Cc: dan.carpenter, andriy.shevchenko, devel, linux-kernel,
linux-media, mchehab, sakari.ailus
On Mon, Aug 31, 2020 at 04:51:04PM +0300, Cengiz Can wrote:
> commit df561f6688fe ("treewide: Use fallthrough pseudo-keyword") from
> Gustavo A. R. Silva replaced and standardized /* fallthrough */ comments
> with 'fallthrough' pseudo-keyword.
>
> However, in one of the switch-case statements, Coverity Static Analyzer
> throws a warning that 'fallthrough' is unreachable due to the adjacent
> 'return false' statement. (Coverity ID CID 1466511)
>
> In order to fix the unreachable code warning, remove unnecessary
> fallthrough keyword.
>
> Signed-off-by: Cengiz Can <cengiz@kernel.wtf>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Thanks
--
Gustavo
> ---
> drivers/staging/media/atomisp/pci/atomisp_compat_css20.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
> index 1b2b2c68025b..feb26c221e96 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
> @@ -711,7 +711,6 @@ static bool is_pipe_valid_to_current_run_mode(struct atomisp_sub_device *asd,
> return true;
>
> return false;
> - fallthrough;
> case ATOMISP_RUN_MODE_VIDEO:
> if (!asd->continuous_mode->val) {
> if (pipe_id == IA_CSS_PIPE_ID_VIDEO ||
> --
> 2.28.0
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] staging: atomisp: Fix fallthrough keyword warning
2020-08-31 13:30 [PATCH] staging: atomisp: Fix fallthrough keyword warning Cengiz Can
2020-08-31 13:40 ` Dan Carpenter
@ 2020-08-31 14:35 ` Mauro Carvalho Chehab
1 sibling, 0 replies; 6+ messages in thread
From: Mauro Carvalho Chehab @ 2020-08-31 14:35 UTC (permalink / raw)
To: Cengiz Can
Cc: Gustavo A . R . Silva, Sakari Ailus, Andy Shevchenko, linux-media,
devel, linux-kernel
Em Mon, 31 Aug 2020 16:30:12 +0300
Cengiz Can <cengiz@kernel.wtf> escreveu:
> commit df561f6688fe ("treewide: Use fallthrough pseudo-keyword") from
> Gustavo A. R. Silva replaced and standardized /* fallthrough */ comments
> with 'fallthrough' pseudo-keyword.
>
> However, in one of the switch-case statements, Coverity Static Analyzer
> throws a warning that 'fallthrough' is unreachable due to the adjacent
> 'return false' statement.
>
> Since 'fallthrough' is actually an empty "do {} while(0)" this might be
> due to compiler optimizations. But that needs further investigation.
>
> In order to fix the unreachable code warning, make adjacent 'return
> false' a part of the previous if statement's else clause.
>
> Reported-by: Coverity Static Analyzer CID 1466511
> Signed-off-by: Cengiz Can <cengiz@kernel.wtf>
> ---
> drivers/staging/media/atomisp/pci/atomisp_compat_css20.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
> index 1b2b2c68025b..aaa2d0e0851b 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
> @@ -709,8 +709,8 @@ static bool is_pipe_valid_to_current_run_mode(struct atomisp_sub_device *asd,
> if (pipe_id == IA_CSS_PIPE_ID_CAPTURE ||
> pipe_id == IA_CSS_PIPE_ID_PREVIEW)
> return true;
> -
> - return false;
> + else
> + return false;
> fallthrough;
Actually, the actual fix here would be to get rid of fallthrough.
Regards,
Thanks,
Mauro
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-08-31 14:35 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-31 13:30 [PATCH] staging: atomisp: Fix fallthrough keyword warning Cengiz Can
2020-08-31 13:40 ` Dan Carpenter
2020-08-31 13:45 ` Dan Carpenter
2020-08-31 13:51 ` [PATCH v2] staging: atomisp: Remove unnecessary 'fallthrough' Cengiz Can
2020-08-31 14:28 ` Gustavo A. R. Silva
2020-08-31 14:35 ` [PATCH] staging: atomisp: Fix fallthrough keyword warning Mauro Carvalho Chehab
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.