Skip to content

Commit 5562326

Browse files
sbrandengregkh
authored andcommitted
test_firmware: remove unnecessary test_fw_mutex in test_dev_config_show_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 <[email protected]> Reviewed-by: Kees Cook <[email protected]> Reviewed-by: Luis Chamberlain <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent ab7c1e1 commit 5562326

File tree

1 file changed

+3
-23
lines changed

1 file changed

+3
-23
lines changed

lib/test_firmware.c

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -310,27 +310,13 @@ static int test_dev_config_update_bool(const char *buf, size_t size,
310310
return ret;
311311
}
312312

313-
static ssize_t
314-
test_dev_config_show_bool(char *buf,
315-
bool config)
313+
static ssize_t test_dev_config_show_bool(char *buf, bool val)
316314
{
317-
bool val;
318-
319-
mutex_lock(&test_fw_mutex);
320-
val = config;
321-
mutex_unlock(&test_fw_mutex);
322-
323315
return snprintf(buf, PAGE_SIZE, "%d\n", val);
324316
}
325317

326-
static ssize_t test_dev_config_show_int(char *buf, int cfg)
318+
static ssize_t test_dev_config_show_int(char *buf, int val)
327319
{
328-
int val;
329-
330-
mutex_lock(&test_fw_mutex);
331-
val = cfg;
332-
mutex_unlock(&test_fw_mutex);
333-
334320
return snprintf(buf, PAGE_SIZE, "%d\n", val);
335321
}
336322

@@ -354,14 +340,8 @@ static int test_dev_config_update_u8(const char *buf, size_t size, u8 *cfg)
354340
return size;
355341
}
356342

357-
static ssize_t test_dev_config_show_u8(char *buf, u8 cfg)
343+
static ssize_t test_dev_config_show_u8(char *buf, u8 val)
358344
{
359-
u8 val;
360-
361-
mutex_lock(&test_fw_mutex);
362-
val = cfg;
363-
mutex_unlock(&test_fw_mutex);
364-
365345
return snprintf(buf, PAGE_SIZE, "%u\n", val);
366346
}
367347

0 commit comments

Comments
 (0)