Re: [PATCH] perf loongarch: Fix discarded-qualifiers warning in _get_field()

From: Huacai Chen

Date: Tue Apr 14 2026 - 04:18:18 EST


On Tue, Apr 14, 2026 at 4:04 PM WANG Rui <r@xxxxxx> wrote:
>
> From: Haiyong Sun <sunhaiyong@xxxxxxxxxxx>
>
> arch/loongarch/util/header.c: In function ‘_get_field’:
> arch/loongarch/util/header.c:31:15: warning: assignment discards ‘const’
> qualifier from pointer target type
> arch/loongarch/util/header.c:36:12: warning: assignment discards ‘const’
> qualifier from pointer target type
>
> Signed-off-by: Haiyong Sun <sunhaiyong@xxxxxxxxxxx>
> Signed-off-by: WANG Rui <r@xxxxxx>
Acked-by: Huacai Chen <chenhuacai@xxxxxxxxxxx>

> ---
> tools/perf/arch/loongarch/util/header.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/arch/loongarch/util/header.c b/tools/perf/arch/loongarch/util/header.c
> index 0c6d82333..46f53a74f 100644
> --- a/tools/perf/arch/loongarch/util/header.c
> +++ b/tools/perf/arch/loongarch/util/header.c
> @@ -26,7 +26,7 @@
>
> static char *_get_field(const char *line)
> {
> - char *line2, *nl;
> + const char *line2, *nl;
>
> line2 = strrchr(line, ' ');
> if (!line2)
> --
> 2.53.0
>
>