From: Cong Liu <liucong2@kylinos.cn>
To: Daniel Vetter <daniel@ffwll.ch>, Helge Deller <deller@gmx.de>
Cc: Cong Liu <liucong2@kylinos.cn>,
linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] fbdev/core: Replace deprecated simple_strtol with kstrtol
Date: Thu, 1 Feb 2024 15:02:16 +0800 [thread overview]
Message-ID: <20240201070216.3291999-1-liucong2@kylinos.cn> (raw)
This patch replaces the use of the deprecated simple_strtol [1] function
in the modedb.c file with the recommended kstrtol function. This change
improves error handling and boundary checks.
[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#simple-strtol-simple-strtoll-simple-strtoul-simple-strtoull
Signed-off-by: Cong Liu <liucong2@kylinos.cn>
---
drivers/video/fbdev/core/modedb.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/video/fbdev/core/modedb.c b/drivers/video/fbdev/core/modedb.c
index 7196b055f2bd..eebbbc7e2aa3 100644
--- a/drivers/video/fbdev/core/modedb.c
+++ b/drivers/video/fbdev/core/modedb.c
@@ -661,7 +661,7 @@ int fb_find_mode(struct fb_var_screeninfo *var,
namelen = i;
if (!refresh_specified && !bpp_specified &&
!yres_specified) {
- refresh = simple_strtol(&name[i+1], NULL,
+ refresh = kstrtol(&name[i+1], NULL,
10);
refresh_specified = 1;
if (cvt || rb)
@@ -672,7 +672,7 @@ int fb_find_mode(struct fb_var_screeninfo *var,
case '-':
namelen = i;
if (!bpp_specified && !yres_specified) {
- bpp = simple_strtol(&name[i+1], NULL,
+ bpp = kstrtol(&name[i+1], NULL,
10);
bpp_specified = 1;
if (cvt || rb)
@@ -682,7 +682,7 @@ int fb_find_mode(struct fb_var_screeninfo *var,
break;
case 'x':
if (!yres_specified) {
- yres = simple_strtol(&name[i+1], NULL,
+ yres = kstrtol(&name[i+1], NULL,
10);
yres_specified = 1;
} else
@@ -719,7 +719,7 @@ int fb_find_mode(struct fb_var_screeninfo *var,
}
}
if (i < 0 && yres_specified) {
- xres = simple_strtol(name, NULL, 10);
+ xres = kstrtol(name, NULL, 10);
res_specified = 1;
}
done:
--
2.34.1
next reply other threads:[~2024-02-01 7:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-01 7:02 Cong Liu [this message]
2024-02-01 10:03 ` [PATCH] fbdev/core: Replace deprecated simple_strtol with kstrtol Jani Nikula
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240201070216.3291999-1-liucong2@kylinos.cn \
--to=liucong2@kylinos.cn \
--cc=daniel@ffwll.ch \
--cc=deller@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).