Commit e5f12a39 authored by Ke Sun's avatar Ke Sun Committed by Alexandre Belloni

rtc: rv3028: Fix codestyle errors

Compiler warnings:

drivers/rtc/rtc-rv3028.c: In function 'rv3028_param_set':
drivers/rtc/rtc-rv3028.c:559:20: warning: statement will never be executed [-Wswitch-unreachable]
  559 |                 u8 mode;
      |                    ^~~~
drivers/rtc/rtc-rv3028.c: In function 'rv3028_param_get':
drivers/rtc/rtc-rv3028.c:526:21: warning: statement will never be executed [-Wswitch-unreachable]
  526 |                 u32 value;
      |                     ^~~~~

Fix it by moving the variable declaration to the beginning of the function.

Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: linux-rtc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Reported-by: default avatark2ci <kernel-bot@kylinos.cn>
Signed-off-by: default avatarKe Sun <sunke@kylinos.cn>
Link: https://lore.kernel.org/r/20221008071321.1799971-1-sunke@kylinos.cnSigned-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent 4919d3eb
...@@ -521,10 +521,9 @@ static int rv3028_param_get(struct device *dev, struct rtc_param *param) ...@@ -521,10 +521,9 @@ static int rv3028_param_get(struct device *dev, struct rtc_param *param)
{ {
struct rv3028_data *rv3028 = dev_get_drvdata(dev); struct rv3028_data *rv3028 = dev_get_drvdata(dev);
int ret; int ret;
u32 value;
switch(param->param) { switch(param->param) {
u32 value;
case RTC_PARAM_BACKUP_SWITCH_MODE: case RTC_PARAM_BACKUP_SWITCH_MODE:
ret = regmap_read(rv3028->regmap, RV3028_BACKUP, &value); ret = regmap_read(rv3028->regmap, RV3028_BACKUP, &value);
if (ret < 0) if (ret < 0)
...@@ -554,9 +553,9 @@ static int rv3028_param_get(struct device *dev, struct rtc_param *param) ...@@ -554,9 +553,9 @@ static int rv3028_param_get(struct device *dev, struct rtc_param *param)
static int rv3028_param_set(struct device *dev, struct rtc_param *param) static int rv3028_param_set(struct device *dev, struct rtc_param *param)
{ {
struct rv3028_data *rv3028 = dev_get_drvdata(dev); struct rv3028_data *rv3028 = dev_get_drvdata(dev);
u8 mode;
switch(param->param) { switch(param->param) {
u8 mode;
case RTC_PARAM_BACKUP_SWITCH_MODE: case RTC_PARAM_BACKUP_SWITCH_MODE:
switch (param->uvalue) { switch (param->uvalue) {
case RTC_BSM_DISABLED: case RTC_BSM_DISABLED:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment