summaryrefslogtreecommitdiff
path: root/drivers/staging/android/alarm-dev.c
diff options
context:
space:
mode:
authorDae S. Kim <dae@velatum.com>2012-08-29 17:08:33 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-04 14:23:33 -0700
commit147cd165757fc67fdf8ae58b015f39c8134970fb (patch)
treedb8052a7ee4da0f29be194844ab3fd31d7179a48 /drivers/staging/android/alarm-dev.c
parent7ee34ab2b37a2a8191bb1b33eebd3ed8cfae0ce6 (diff)
Staging: android: Alarm driver cleanups
Little cleanups. Enum value ANDROID_ALARM_TYPE_COUNT was treated as an alarm type within a switch statement. That condition was unreachable though. Signed-off-by: Dae S. Kim <dae@velatum.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/android/alarm-dev.c')
-rw-r--r--drivers/staging/android/alarm-dev.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/staging/android/alarm-dev.c b/drivers/staging/android/alarm-dev.c
index 5b7064005188..a9b293ff3cc8 100644
--- a/drivers/staging/android/alarm-dev.c
+++ b/drivers/staging/android/alarm-dev.c
@@ -67,10 +67,8 @@ static struct devalarm alarms[ANDROID_ALARM_TYPE_COUNT];
static int is_wakeup(enum android_alarm_type type)
{
- if (type == ANDROID_ALARM_RTC_WAKEUP ||
- type == ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP)
- return 1;
- return 0;
+ return (type == ANDROID_ALARM_RTC_WAKEUP ||
+ type == ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP);
}
@@ -85,12 +83,9 @@ static void devalarm_start(struct devalarm *alrm, ktime_t exp)
static int devalarm_try_to_cancel(struct devalarm *alrm)
{
- int ret;
if (is_wakeup(alrm->type))
- ret = alarm_try_to_cancel(&alrm->u.alrm);
- else
- ret = hrtimer_try_to_cancel(&alrm->u.hrt);
- return ret;
+ return alarm_try_to_cancel(&alrm->u.alrm);
+ return hrtimer_try_to_cancel(&alrm->u.hrt);
}
static void devalarm_cancel(struct devalarm *alrm)
@@ -223,10 +218,12 @@ from_old_alarm_set:
case ANDROID_ALARM_ELAPSED_REALTIME:
get_monotonic_boottime(&tmp_time);
break;
- case ANDROID_ALARM_TYPE_COUNT:
case ANDROID_ALARM_SYSTEMTIME:
ktime_get_ts(&tmp_time);
break;
+ default:
+ rv = -EINVAL;
+ goto err1;
}
if (copy_to_user((void __user *)arg, &tmp_time,
sizeof(tmp_time))) {