test_firmware: remove unnecessary test_fw_mutex in test_dev_config_show_xxx
authorScott Branden <scott.branden@broadcom.com>
Wed, 15 Apr 2020 00:25:17 +0000 (17:25 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Apr 2020 07:59:39 +0000 (09:59 +0200)
Remove unnecessary use of test_fw_mutex in test_dev_config_show_xxx
functions that show simple bool, int, and u8.

Signed-off-by: Scott Branden <scott.branden@broadcom.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Link: https://lore.kernel.org/r/20200415002517.4328-1-scott.branden@broadcom.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
lib/test_firmware.c

index 0c7fbcf07ac5d6ab422487baaa8a7fc9596c53d8..9fee2b93a8d18c0d2a343ec4e3d3fd173b3c62d2 100644 (file)
@@ -310,27 +310,13 @@ static int test_dev_config_update_bool(const char *buf, size_t size,
        return ret;
 }
 
-static ssize_t
-test_dev_config_show_bool(char *buf,
-                         bool config)
+static ssize_t test_dev_config_show_bool(char *buf, bool val)
 {
-       bool val;
-
-       mutex_lock(&test_fw_mutex);
-       val = config;
-       mutex_unlock(&test_fw_mutex);
-
        return snprintf(buf, PAGE_SIZE, "%d\n", val);
 }
 
-static ssize_t test_dev_config_show_int(char *buf, int cfg)
+static ssize_t test_dev_config_show_int(char *buf, int val)
 {
-       int val;
-
-       mutex_lock(&test_fw_mutex);
-       val = cfg;
-       mutex_unlock(&test_fw_mutex);
-
        return snprintf(buf, PAGE_SIZE, "%d\n", val);
 }
 
@@ -354,14 +340,8 @@ static int test_dev_config_update_u8(const char *buf, size_t size, u8 *cfg)
        return size;
 }
 
-static ssize_t test_dev_config_show_u8(char *buf, u8 cfg)
+static ssize_t test_dev_config_show_u8(char *buf, u8 val)
 {
-       u8 val;
-
-       mutex_lock(&test_fw_mutex);
-       val = cfg;
-       mutex_unlock(&test_fw_mutex);
-
        return snprintf(buf, PAGE_SIZE, "%u\n", val);
 }