Skip to content

Commit cff8b60

Browse files
ndrs-pstnashif
authored andcommitted
fb: cfb_shell: use shell_strtol in cmd_set_kerning
Switch from using direct `strtol` calls to `shell_strtol`. This change leverages the extensive error handling provided by `shell_strtol`. Signed-off-by: Pisit Sawangvonganan <[email protected]>
1 parent 06e0b2d commit cff8b60

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

subsys/fb/cfb_shell.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -340,18 +340,16 @@ static int cmd_set_font(const struct shell *sh, size_t argc, char *argv[])
340340

341341
static int cmd_set_kerning(const struct shell *sh, size_t argc, char *argv[])
342342
{
343-
int err;
344-
char *ep = NULL;
343+
int err = 0;
345344
long kerning;
346345

347346
if (!dev) {
348347
shell_error(sh, HELP_INIT);
349348
return -ENODEV;
350349
}
351350

352-
errno = 0;
353-
kerning = strtol(argv[1], &ep, 10);
354-
if (errno || ep == argv[1]) {
351+
kerning = shell_strtol(argv[1], 10, &err);
352+
if (err) {
355353
shell_error(sh, HELP_INIT);
356354
return -EINVAL;
357355
}

0 commit comments

Comments
 (0)