[9610][7885][7872][7570] wlbt: Test for mx_logger_dump.sh
authorIvan Priest <i.priest@samsung.com>
Thu, 28 Jun 2018 13:39:25 +0000 (14:39 +0100)
committerIvan Priest <i.priest@samsung.com>
Wed, 11 Jul 2018 17:43:18 +0000 (18:43 +0100)
Test for presence of the mx_logger_dump.sh script before
trying to use it, to suppress error messages in the
kernel log.

Change-Id: I65833c5ff01714dec555c0ff1f63d20cbc97ae79
SCSC-Bug-Id: SSB-41411
Signed-off-by: Ivan Priest <i.priest@samsung.com>
drivers/misc/samsung/scsc/mxman.c

index d8e0153442e93258f89708a2e1acd323962a8ce8..bfaf6636a2b873c70d76c7eacead48e3505322d4 100755 (executable)
@@ -1921,6 +1921,22 @@ static int _mx_exec(char *prog, int wait_exec)
        return result;
 }
 
+#if defined(CONFIG_SCSC_PRINTK) && !defined(CONFIG_SCSC_WLBTD)
+static int __stat(const char *file)
+{
+       struct kstat stat;
+       mm_segment_t fs;
+       int r;
+
+       fs = get_fs();
+       set_fs(get_ds());
+       r = vfs_stat(file, &stat);
+       set_fs(fs);
+
+       return r;
+}
+#endif
+
 int mx140_log_dump(void)
 {
 #ifdef CONFIG_SCSC_PRINTK
@@ -1934,6 +1950,15 @@ int mx140_log_dump(void)
        if (r) {
                SCSC_TAG_ERR(MXMAN, "mx_logger_dump.sh path error\n");
        } else {
+               /*
+                * Test presence of script before invoking, to suppress
+                * unnecessary error message if not installed.
+                */
+               r = __stat(mxlbin);
+               if (r) {
+                       SCSC_TAG_DEBUG(MXMAN, "%s not installed\n", mxlbin);
+                       return r;
+               }
                SCSC_TAG_INFO(MXMAN, "Invoking mx_logger_dump.sh UHM\n");
                r = _mx_exec(mxlbin, UMH_WAIT_EXEC);
                if (r)