summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSoon-Yong Cho <soonyong.cho@samsung.com>2016-08-31 11:21:33 +0900
committerjino.cho <jino.cho@samsung.com>2017-03-03 17:02:47 +0900
commit62413a7859a2adf7256f168fc6589cef2190b986 (patch)
tree1e990b49e5f973b2eceb43b17b1cfb17e5e9fd4b
parent7466a71560d8920049ed1049d5e2d2ec87b9b649 (diff)
downloadlinux-3.10-artik-62413a7859a2adf7256f168fc6589cef2190b986.tar.gz
linux-3.10-artik-62413a7859a2adf7256f168fc6589cef2190b986.tar.bz2
linux-3.10-artik-62413a7859a2adf7256f168fc6589cef2190b986.zip
misc: artik_zb_power: fix uninitialized local variable
This patch removes uninitialized local variable 'ret' in artik_zb_recovery_control function and changes return type to void from int. Change-Id: Ic2daefb1357ee93f2ca814b70f7f7708f4bbc070 Signed-off-by: Soon-Yong Cho <soonyong.cho@samsung.com>
-rw-r--r--drivers/misc/artik_zb_power.c59
1 files changed, 26 insertions, 33 deletions
diff --git a/drivers/misc/artik_zb_power.c b/drivers/misc/artik_zb_power.c
index 7827abb7189..9caf67de6c3 100644
--- a/drivers/misc/artik_zb_power.c
+++ b/drivers/misc/artik_zb_power.c
@@ -88,39 +88,34 @@ static int artik_zb_power_control(struct artik_zb_power_platform_data *pdata,
return ret;
}
-static int artik_zb_recovery_control(struct artik_zb_power_platform_data *pdata,
+static void artik_zb_recovery_control(struct artik_zb_power_platform_data *pdata,
int onoff)
{
- int ret;
-
- if (onoff == pdata->recovery_mode)
- return 0;
-
- if (onoff) {
- /* Turn off device */
- gpio_set_value(pdata->reset_gpio, 0);
- gpio_set_value(pdata->bootloader_gpio, 0);
-
- /* EM358x chip needs 26usec hold time to reset device */
- udelay(30);
-
- /* Go to recovery mode */
- gpio_set_value(pdata->reset_gpio, 1);
- } else {
- /* Turn off */
- gpio_set_value(pdata->reset_gpio, 0);
- gpio_set_value(pdata->bootloader_gpio, 0);
-
- /* EM358x chip needs 26usec hold time to reset device */
- udelay(30);
-
- /* Go to normal mode */
- gpio_set_value(pdata->bootloader_gpio, 1);
- gpio_set_value(pdata->reset_gpio, 1);
+ if (onoff != pdata->recovery_mode) {
+ if (onoff) {
+ /* Turn off device */
+ gpio_set_value(pdata->reset_gpio, 0);
+ gpio_set_value(pdata->bootloader_gpio, 0);
+
+ /* EM358x chip needs 26usec hold time to reset device */
+ udelay(30);
+
+ /* Go to recovery mode */
+ gpio_set_value(pdata->reset_gpio, 1);
+ } else {
+ /* Turn off */
+ gpio_set_value(pdata->reset_gpio, 0);
+ gpio_set_value(pdata->bootloader_gpio, 0);
+
+ /* EM358x chip needs 26usec hold time to reset device */
+ udelay(30);
+
+ /* Go to normal mode */
+ gpio_set_value(pdata->bootloader_gpio, 1);
+ gpio_set_value(pdata->reset_gpio, 1);
+ }
+ pdata->recovery_mode = onoff;
}
- pdata->recovery_mode = onoff;
-
- return ret;
}
static ssize_t show_zb_power_status(struct device *dev,
@@ -178,9 +173,7 @@ static ssize_t set_zb_recovery_status(struct device *dev,
if (ret)
return -EINVAL;
- ret = artik_zb_recovery_control(pdata, !!val);
- if (ret)
- return -EINVAL;
+ artik_zb_recovery_control(pdata, !!val);
return count; /* if success returns count, if failed returns - */
}