ANDROID: uid_sys_stats: allow writing same state
authorJin Qian <jinqian@google.com>
Wed, 18 Jan 2017 01:26:07 +0000 (17:26 -0800)
committerAmit Pundir <amit.pundir@linaro.org>
Mon, 10 Apr 2017 07:42:16 +0000 (13:12 +0530)
Signed-off-by: Jin Qian <jinqian@google.com>
Bug: 34360629
Change-Id: Ia748351e07910b1febe54f0484ca1be58c4eb9c7

drivers/misc/uid_sys_stats.c

index f5135bb01a7af65eb1b0e1ea57f5545660bf49e1..5f82d17e7ad9750d48baf4d9bfd29d68b6de5e44 100644 (file)
@@ -339,11 +339,16 @@ static ssize_t uid_procstat_write(struct file *file,
        mutex_lock(&uid_lock);
 
        uid_entry = find_or_register_uid(uid);
-       if (!uid_entry || uid_entry->state == state) {
+       if (!uid_entry) {
                mutex_unlock(&uid_lock);
                return -EINVAL;
        }
 
+       if (uid_entry->state == state) {
+               mutex_unlock(&uid_lock);
+               return count;
+       }
+
        update_io_stats_locked();
 
        uid_entry->state = state;