[IMPROVE] add error return inc for usm_/start/stop()
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>
Thu, 5 Sep 2013 09:09:08 +0000 (13:09 +0400)
committerVyacheslav Cherkashin <v.cherkashin@samsung.com>
Thu, 5 Sep 2013 09:09:08 +0000 (13:09 +0400)
Change-Id: Ifd63847e8f520e42a2369ebd8febcf14a7390d30
Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
us_manager/us_manager.c

index 80c1b70..ee2ba7b 100644 (file)
@@ -182,9 +182,14 @@ static int do_usm_start(void)
 
 int usm_stop(void)
 {
+       int ret = 0;
+
        mutex_lock(&mutex_inst);
-       if (flag_inst == 0)
+       if (flag_inst == 0) {
+               printk("US instrumentation is not running!\n");
+               ret = -EINVAL;
                goto unlock;
+       }
 
        do_usm_stop();
 
@@ -192,17 +197,19 @@ int usm_stop(void)
 unlock:
        mutex_unlock(&mutex_inst);
 
-       return 0;
+       return ret;
 }
 EXPORT_SYMBOL_GPL(usm_stop);
 
 int usm_start(void)
 {
-       int ret;
+       int ret = -EINVAL;
 
        mutex_lock(&mutex_inst);
-       if (flag_inst)
+       if (flag_inst) {
+               printk("US instrumentation is already run!\n");
                goto unlock;
+       }
 
        ret = do_usm_start();
        if (ret == 0)