[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240201070226.3292315-1-liucong2@kylinos.cn>
Date: Thu, 1 Feb 2024 15:02:25 +0800
From: Cong Liu <liucong2@...inos.cn>
To: Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>
Cc: Cong Liu <liucong2@...inos.cn>,
dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] drm/modes: Replace deprecated simple_strtol with kstrtol
This patch replaces the use of the deprecated simple_strtol [1] function
in the drm_modes.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@...inos.cn>
---
drivers/gpu/drm/drm_modes.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 893f52ee4926..fce0fb1df9b2 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -1942,7 +1942,7 @@ static int drm_mode_parse_cmdline_bpp(const char *str, char **end_ptr,
return -EINVAL;
str++;
- bpp = simple_strtol(str, end_ptr, 10);
+ bpp = kstrtol(str, end_ptr, 10);
if (*end_ptr == str)
return -EINVAL;
@@ -1961,7 +1961,7 @@ static int drm_mode_parse_cmdline_refresh(const char *str, char **end_ptr,
return -EINVAL;
str++;
- refresh = simple_strtol(str, end_ptr, 10);
+ refresh = kstrtol(str, end_ptr, 10);
if (*end_ptr == str)
return -EINVAL;
@@ -2033,7 +2033,7 @@ static int drm_mode_parse_cmdline_res_mode(const char *str, unsigned int length,
int remaining, i;
char *end_ptr;
- xres = simple_strtol(str, &end_ptr, 10);
+ xres = kstrtol(str, &end_ptr, 10);
if (end_ptr == str)
return -EINVAL;
@@ -2042,7 +2042,7 @@ static int drm_mode_parse_cmdline_res_mode(const char *str, unsigned int length,
end_ptr++;
str = end_ptr;
- yres = simple_strtol(str, &end_ptr, 10);
+ yres = kstrtol(str, &end_ptr, 10);
if (end_ptr == str)
return -EINVAL;
@@ -2100,7 +2100,7 @@ static int drm_mode_parse_cmdline_int(const char *delim, unsigned int *int_ret)
return -EINVAL;
value = delim + 1;
- *int_ret = simple_strtol(value, &endp, 10);
+ *int_ret = kstrtol(value, &endp, 10);
/* Make sure we have parsed something */
if (endp == value)
--
2.34.1
Powered by blists - more mailing lists