From 6a7e54dff12db20a3053683c4d40f3717b1f1dc4 Mon Sep 17 00:00:00 2001 From: Ivan Priest Date: Thu, 28 Jun 2018 14:39:25 +0100 Subject: [PATCH] [9610][7885][7872][7570] wlbt: Test for mx_logger_dump.sh 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 --- drivers/misc/samsung/scsc/mxman.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/misc/samsung/scsc/mxman.c b/drivers/misc/samsung/scsc/mxman.c index d8e0153442e9..bfaf6636a2b8 100755 --- a/drivers/misc/samsung/scsc/mxman.c +++ b/drivers/misc/samsung/scsc/mxman.c @@ -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) -- 2.20.1