author: Alexey Dobriyan <adobriyan@gmail.com> 2020-12-15 20:44:00 -0800
committer: Linus Torvalds <torvalds@linux-foundation.org> 2020-12-15 22:46:16 -0800
commit: 506dfc9906e5cbf453bbcd5eb627689435583558
parent: d58b0b1a416595a0e5ad6eac559b1d5229397e38
Commit Summary:
Diffstat:
1 file changed, 3 insertions, 6 deletions
diff --git a/lib/test_firmware.c b/lib/test_firmware.c
index 2baa275a6ddf..b6fe89add9fe 100644
--- a/lib/test_firmware.c
+++ b/lib/test_firmware.c
@@ -364,18 +364,15 @@ static ssize_t test_dev_config_show_int(char *buf, int val)
static int test_dev_config_update_u8(const char *buf, size_t size, u8 *cfg)
{
+ u8 val;
int ret;
- long new;
- ret = kstrtol(buf, 10, &new);
+ ret = kstrtou8(buf, 10, &val);
if (ret)
return ret;
- if (new > U8_MAX)
- return -EINVAL;
-
mutex_lock(&test_fw_mutex);
- *(u8 *)cfg = new;
+ *(u8 *)cfg = val;
mutex_unlock(&test_fw_mutex);
/* Always return full write size even if we didn't consume all */