b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | From 250363a413cd08e723789e1b8821608ff5eebfe6 Mon Sep 17 00:00:00 2001 |
| 2 | From: Hans de Goede <hdegoede@redhat.com> |
| 3 | Date: Mon, 18 Nov 2019 16:51:23 +0100 |
| 4 | Subject: [PATCH] drm/modes: parse_cmdline: Make various char pointers |
| 5 | const |
| 6 | |
| 7 | Commit 83e14ea3a64f00897cc31974d3ae4e27e5a7405b upstream. |
| 8 | |
| 9 | We are not supposed to modify the passed in string, make char pointers |
| 10 | used in drm_mode_parse_cmdline_options() const char * where possible. |
| 11 | |
| 12 | Acked-by: Maxime Ripard <mripard@kernel.org> |
| 13 | Signed-off-by: Hans de Goede <hdegoede@redhat.com> |
| 14 | Link: https://patchwork.freedesktop.org/patch/msgid/20191118155134.30468-2-hdegoede@redhat.com |
| 15 | --- |
| 16 | drivers/gpu/drm/drm_modes.c | 10 +++++----- |
| 17 | 1 file changed, 5 insertions(+), 5 deletions(-) |
| 18 | |
| 19 | --- a/drivers/gpu/drm/drm_modes.c |
| 20 | +++ b/drivers/gpu/drm/drm_modes.c |
| 21 | @@ -1591,15 +1591,15 @@ static int drm_mode_parse_cmdline_int(co |
| 22 | return 0; |
| 23 | } |
| 24 | |
| 25 | -static int drm_mode_parse_cmdline_options(char *str, size_t len, |
| 26 | +static int drm_mode_parse_cmdline_options(const char *str, size_t len, |
| 27 | const struct drm_connector *connector, |
| 28 | struct drm_cmdline_mode *mode) |
| 29 | { |
| 30 | unsigned int deg, margin, rotation = 0; |
| 31 | - char *sep = str; |
| 32 | + const char *sep = str; |
| 33 | |
| 34 | while ((sep = strchr(sep, ','))) { |
| 35 | - char *delim, *option; |
| 36 | + const char *delim, *option; |
| 37 | |
| 38 | option = sep + 1; |
| 39 | delim = strchr(option, '='); |
| 40 | @@ -1725,8 +1725,8 @@ bool drm_mode_parse_command_line_for_con |
| 41 | bool named_mode = false, parse_extras = false; |
| 42 | unsigned int bpp_off = 0, refresh_off = 0, options_off = 0; |
| 43 | unsigned int mode_end = 0; |
| 44 | - char *bpp_ptr = NULL, *refresh_ptr = NULL, *extra_ptr = NULL; |
| 45 | - char *options_ptr = NULL; |
| 46 | + const char *bpp_ptr = NULL, *refresh_ptr = NULL, *extra_ptr = NULL; |
| 47 | + const char *options_ptr = NULL; |
| 48 | char *bpp_end_ptr = NULL, *refresh_end_ptr = NULL; |
| 49 | int ret; |
| 50 | |