lib: cleanup kstrto*() usage

Use proper conversion functions.  kstrto*() variants exist for all
standard types.

Link: https://lkml.kernel.org/r/20201122123410.GB92364@localhost.localdomain
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Alexey Dobriyan
2020-12-15 20:44:00 -08:00
committed by Linus Torvalds
parent d58b0b1a41
commit 506dfc9906
2 changed files with 13 additions and 22 deletions

View File

@@ -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 */