]> git.baikalelectronics.ru Git - kernel.git/commit
rtc: Move variable into switch case statement
authorKees Cook <keescook@chromium.org>
Thu, 9 Dec 2021 04:39:15 +0000 (20:39 -0800)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Wed, 5 Jan 2022 00:03:09 +0000 (01:03 +0100)
commitab356f494415631cde49a696cf7e55e81a38c148
tree74dff1ec57759c0d82e61196bfc5305bf4d175d2
parent50b1e6cc79c4d580e4a9d88b802bafa0ccbbc75e
rtc: Move variable into switch case statement

When building with automatic stack variable initialization, GCC 12
complains about variables defined outside of switch case statements.
Move the variable into the case that uses it, which silences the warning:

drivers/rtc/dev.c: In function 'rtc_dev_ioctl':
drivers/rtc/dev.c:394:30: warning: statement will never be executed [-Wswitch-unreachable]
  394 |                         long offset;
      |                              ^~~~~~

Fixes: cb7ac1593277 ("rtc: add parameter ioctl")
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20211209043915.1378393-1-keescook@chromium.org
drivers/rtc/dev.c