counter: add defaults to switch-statements
authorTom Rix <trix@redhat.com>
Tue, 15 Mar 2022 19:38:57 +0000 (15:38 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Mar 2022 13:04:30 +0000 (14:04 +0100)
commit04c633873c01ce0591b05404af6481100871a921
tree54d6a1b06e891a4e96fb723d409be89bf7f9518d
parentcac229ed3fde01c7dd488032b77a8f7459362660
counter: add defaults to switch-statements

Clang static analysis reports this representative problem
counter-chrdev.c:482:3: warning: Undefined or garbage value
  returned to caller
  return ret;
  ^~~~~~~~~~

counter_get_data() has a multilevel switches, some without
defaults, so ret is sometimes not set.
Add returning -EINVAL similar to other defaults.

Link: https://lore.kernel.org/r/20220227161746.82776-1-trix@redhat.com
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Syed Nayyar Waris <syednwaris@gmail.com>
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/b98d1a3ed4b0b324b261b23defd1bdddddba4d44.1647373009.git.vilhelm.gray@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/counter/counter-chrdev.c