Skip to content

Commit

Permalink
test_firmware: remove unnecessary test_fw_mutex in test_dev_config_sh…
Browse files Browse the repository at this point in the history
…ow_xxx

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>
  • Loading branch information
Scott Branden authored and Greg Kroah-Hartman committed Apr 17, 2020
1 parent ab7c1e1 commit 5562326
Showing 1 changed file with 3 additions and 23 deletions.
26 changes: 3 additions & 23 deletions lib/test_firmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand Down

0 comments on commit 5562326

Please sign in to comment.