Skip to contentSkip to conversation

media: atomisp: re-enable warnings again

bug report Dan Carpenter 1 participant 1 message Aug 25, 2020 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

Hello Mauro Carvalho Chehab,

The patch 5b552b198c25: "media: atomisp: re-enable warnings again" from May 30, 2020, leads to the following static checker warning:

drivers/staging/media/atomisp/pci/atomisp_compat_css20.c:714 is_pipe_valid_to_current_run_mode()
warn: ignoring unreachable code.

drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
694 switch (asd->run_mode->val) {
695 case ATOMISP_RUN_MODE_STILL_CAPTURE:
696 if (pipe_id == IA_CSS_PIPE_ID_CAPTURE)
697 return true;
698
699 return false;
700 case ATOMISP_RUN_MODE_PREVIEW:
701 if (!asd->continuous_mode->val) {
702 if (pipe_id == IA_CSS_PIPE_ID_PREVIEW)
703 return true;
704
705 return false;
706 }
707 fallthrough;

I bet all these fallthrough annotations should just be "return false;"

708 case ATOMISP_RUN_MODE_CONTINUOUS_CAPTURE:
709 if (pipe_id == IA_CSS_PIPE_ID_CAPTURE ||
710 pipe_id == IA_CSS_PIPE_ID_PREVIEW)
711 return true;
712
713 return false;
714 fallthrough;

Either way, this one is clearly unreachable.

   715          case ATOMISP_RUN_MODE_VIDEO:
   716                  if (!asd->continuous_mode->val) {
   717                          if (pipe_id == IA_CSS_PIPE_ID_VIDEO ||
   718                              pipe_id == IA_CSS_PIPE_ID_YUVPP)
   719                                  return true;
   720                          else
   721                                  return false;
   722                  }
   723                  fallthrough;
   724          case ATOMISP_RUN_MODE_SDV:
   725                  if (pipe_id == IA_CSS_PIPE_ID_CAPTURE ||
   726                      pipe_id == IA_CSS_PIPE_ID_VIDEO)
   727                          return true;
   728  
   729                  return false;
   730          }

regards,
dan carpenter