Skip to contentSkip to conversation

Fix two instances of -Wstrict-prototypes in drm/amd

PATCH Applied Nathan Chancellor 3 participants 7 messages Apr 11, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Fix two instances of -Wstrict-prototypes in drm/amd

Hi everyone,

These two patches resolve two instances of -Wstrict-prototypes with newer versions of clang that are present in 5.4. The main Makefile makes this a hard error.

The first patch is upstream commit 63617d8b125e ("drm/amdkfd: add missing void argument to function kgd2kfd_init"), which showed up in 5.5.

The second patch has no upstream equivalent, as the code in question was removed in commit e392c887df97 ("drm/amdkfd: Use array to probe kfd2kgd_calls") upstream, which is part of a larger series that did not look reasonable for stable. I opted to just fix the warning in the same manner as the prior patch, which is less risky and accomplishes the same end result of no warning.

Colin Ian King (1):
drm/amdkfd: add missing void argument to function kgd2kfd_init

Nathan Chancellor (1):
drm/amdkfd: Fix -Wstrict-prototypes from

    amdgpu_amdkfd_gfx_10_0_get_functions()
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c | 2 +-
 drivers/gpu/drm/amd/amdkfd/kfd_module.c            | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

base-commit: 2845ff3fd34499603249676495c524a35e795b45

Signature · 1 line
2.35.1
#1 lore raw

PATCH 1/2 drm/amdkfd: add missing void argument to function kgd2kfd_init

From: Colin Ian King <[email protected]>

commit 63617d8b125ed9f674133dd000b6df58d6b2965a upstream.

Function kgd2kfd_init is missing a void argument, add it to clean up the non-ANSI function declaration.

---
 drivers/gpu/drm/amd/amdkfd/kfd_module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_module.c +1 -1
index 986ff52d5750..f4b7f7e6c40e 100644
@@ -82,7 +82,7 @@ static void kfd_exit(void)
 	kfd_chardev_exit();
 }
 
-int kgd2kfd_init()
+int kgd2kfd_init(void)
 {
 	return kfd_init();
 }
Signature · 1 line
2.35.1
maintainer Applied
#2 lore raw

Patch "drm/amdkfd: add missing void argument to function kgd2kfd_init" has been added to the 5.4-stable tree

This is a note to let you know that I've just added the patch titled

drm/amdkfd: add missing void argument to function kgd2kfd_init

to the 5.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
drm-amdkfd-add-missing-void-argument-to-function-kgd2kfd_init.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

From foo@baz Mon Apr 11 06:48:58 PM CEST 2022
From: Nathan Chancellor <[email protected]>
Date: Mon, 11 Apr 2022 09:43:07 -0700
Subject: drm/amdkfd: add missing void argument to function kgd2kfd_init
To: Greg Kroah-Hartman <[email protected]>, Sasha Levin <[email protected]>
Cc: Felix Kuehling <[email protected]>, Alex Deucher <[email protected]>, Nick Desaulniers <[email protected]>, [email protected], [email protected], [email protected], Colin Ian King <[email protected]>, Randy Dunlap <[email protected]>, Nathan Chancellor <[email protected]>
Message-ID: <[email protected]>

From: Nathan Chancellor <[email protected]>

From: Colin Ian King <[email protected]>

commit 63617d8b125ed9f674133dd000b6df58d6b2965a upstream.

Function kgd2kfd_init is missing a void argument, add it to clean up the non-ANSI function declaration.

---
 drivers/gpu/drm/amd/amdkfd/kfd_module.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_module.c +1 -1
@@ -82,7 +82,7 @@ static void kfd_exit(void)
 	kfd_chardev_exit();
 }
 
-int kgd2kfd_init()
+int kgd2kfd_init(void)
 {
 	return kfd_init();
 }

Patches currently in stable-queue which might be from [email protected] are

queue-5.4/drm-amdkfd-fix-wstrict-prototypes-from-amdgpu_amdkfd_gfx_10_0_get_functions.patch queue-5.4/drm-amdkfd-add-missing-void-argument-to-function-kgd2kfd_init.patch queue-5.4/arm64-module-remove-noload-from-linker-script.patch queue-5.4/tools-build-filter-out-options-and-warnings-not-supported-by-clang.patch queue-5.4/riscv-module-remove-noload.patch queue-5.4/tools-build-use-shell-instead-of-to-get-embedded-libperl-s-ccopts.patch

#3 lore raw

PATCH 2/2 drm/amdkfd: Fix -Wstrict-prototypes from amdgpu_amdkfd_gfx_10_0_get_functions()

In reply to Nathan Chancellor

This patch is for linux-5.4.y only, it has no equivalent change upstream.

When building x86_64 allmodconfig with tip of tree clang, there is an instance of -Wstrict-prototypes:

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c:168:59: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] struct kfd2kgd_calls *amdgpu_amdkfd_gfx_10_0_get_functions()

                                                            ^
                                                             void

1 error generated.

amdgpu_amdkfd_gfx_10_0_get_functions() is prototyped properly in drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h but its definition in amdgpu_amdkfd_gfx_v10.c does not have the argument types specified, which causes the warning. GCC does not warn because it permits an old-style definition if the prototype has the argument types.

This code was eliminated by commit e392c887df97 ("drm/amdkfd: Use array to probe kfd2kgd_calls"), which was a part of a larger series that does not look very suitable for stable. Just fix this one location, as it was the only instance of this new warning across a variety of builds.

Fixes 6bdadb207224 ("drm/amdgpu: Add navi10 kfd support for amdgpu (v3)")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c +1 -1
index ce30d4e8bf25..f7c4337c1ffe 100644
@@ -165,7 +165,7 @@ static const struct kfd2kgd_calls kfd2kgd = {
 	.get_tile_config = amdgpu_amdkfd_get_tile_config,
 };
 
-struct kfd2kgd_calls *amdgpu_amdkfd_gfx_10_0_get_functions()
+struct kfd2kgd_calls *amdgpu_amdkfd_gfx_10_0_get_functions(void)
 {
 	return (struct kfd2kgd_calls *)&kfd2kgd;
 }
Signature · 1 line
2.35.1
maintainer Applied
#4 lore raw

Patch "drm/amdkfd: Fix -Wstrict-prototypes from amdgpu_amdkfd_gfx_10_0_get_functions()" has been added to the 5.4-stable tree

This is a note to let you know that I've just added the patch titled

drm/amdkfd: Fix -Wstrict-prototypes from amdgpu_amdkfd_gfx_10_0_get_functions()

to the 5.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
drm-amdkfd-fix-wstrict-prototypes-from-amdgpu_amdkfd_gfx_10_0_get_functions.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

From foo@baz Mon Apr 11 06:48:58 PM CEST 2022
From: Nathan Chancellor <[email protected]>
Date: Mon, 11 Apr 2022 09:43:08 -0700
Subject: drm/amdkfd: Fix -Wstrict-prototypes from amdgpu_amdkfd_gfx_10_0_get_functions()
To: Greg Kroah-Hartman <[email protected]>, Sasha Levin <[email protected]>
Cc: Felix Kuehling <[email protected]>, Alex Deucher <[email protected]>, Nick Desaulniers <[email protected]>, [email protected], [email protected], [email protected], Nathan Chancellor <[email protected]>
Message-ID: <[email protected]>

From: Nathan Chancellor <[email protected]>

This patch is for linux-5.4.y only, it has no equivalent change upstream.

When building x86_64 allmodconfig with tip of tree clang, there is an instance of -Wstrict-prototypes:

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c:168:59: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] struct kfd2kgd_calls *amdgpu_amdkfd_gfx_10_0_get_functions()

                                                            ^
                                                             void

1 error generated.

amdgpu_amdkfd_gfx_10_0_get_functions() is prototyped properly in drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h but its definition in amdgpu_amdkfd_gfx_v10.c does not have the argument types specified, which causes the warning. GCC does not warn because it permits an old-style definition if the prototype has the argument types.

This code was eliminated by commit e392c887df97 ("drm/amdkfd: Use array to probe kfd2kgd_calls"), which was a part of a larger series that does not look very suitable for stable. Just fix this one location, as it was the only instance of this new warning across a variety of builds.

Fixes 6bdadb207224 ("drm/amdgpu: Add navi10 kfd support for amdgpu (v3)")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c +1 -1
@@ -165,7 +165,7 @@ static const struct kfd2kgd_calls kfd2kg
 	.get_tile_config = amdgpu_amdkfd_get_tile_config,
 };
 
-struct kfd2kgd_calls *amdgpu_amdkfd_gfx_10_0_get_functions()
+struct kfd2kgd_calls *amdgpu_amdkfd_gfx_10_0_get_functions(void)
 {
 	return (struct kfd2kgd_calls *)&kfd2kgd;
 }

Patches currently in stable-queue which might be from [email protected] are

queue-5.4/drm-amdkfd-fix-wstrict-prototypes-from-amdgpu_amdkfd_gfx_10_0_get_functions.patch queue-5.4/drm-amdkfd-add-missing-void-argument-to-function-kgd2kfd_init.patch queue-5.4/arm64-module-remove-noload-from-linker-script.patch queue-5.4/tools-build-filter-out-options-and-warnings-not-supported-by-clang.patch queue-5.4/riscv-module-remove-noload.patch queue-5.4/tools-build-use-shell-instead-of-to-get-embedded-libperl-s-ccopts.patch

maintainer Acked-by on the v1 series
#5 lore raw
In reply to Nathan Chancellor

[Public]

Quoted 28 lines

-----Original Message-----
From: Nathan Chancellor <[email protected]>
Sent: Monday, April 11, 2022 12:43 PM
To: Greg Kroah-Hartman <[email protected]>; Sasha Levin <[email protected]>
Cc: Kuehling, Felix <[email protected]>; Deucher, Alexander <[email protected]>; Nick Desaulniers <[email protected]>; [email protected]; [email protected]; [email protected]; Nathan Chancellor <[email protected]>
Subject: [PATCH 5.4 0/2] Fix two instances of -Wstrict-prototypes in drm/amd

Hi everyone,

These two patches resolve two instances of -Wstrict-prototypes with newer versions of clang that are present in 5.4. The main Makefile makes this a hard error.

The first patch is upstream commit 63617d8b125e ("drm/amdkfd: add missing void argument to function kgd2kfd_init"), which showed up in 5.5.

The second patch has no upstream equivalent, as the code in question was removed in commit e392c887df97 ("drm/amdkfd: Use array to probe kfd2kgd_calls") upstream, which is part of a larger series that did not look reasonable for stable. I opted to just fix the warning in the same manner as the prior patch, which is less risky and accomplishes the same end result of no warning.

Quoted 6 lines

Colin Ian King (1):
drm/amdkfd: add missing void argument to function kgd2kfd_init

Nathan Chancellor (1):
drm/amdkfd: Fix -Wstrict-prototypes from

    amdgpu_amdkfd_gfx_10_0_get_functions()

Series is:

Quoted 9 lines
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c | 2 +-
 drivers/gpu/drm/amd/amdkfd/kfd_module.c            | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

base-commit: 2845ff3fd34499603249676495c524a35e795b45 --
2.35.1

#6 lore raw
In reply to Nathan Chancellor
Quoted 22 lines · Nathan Chancellor

Hi everyone,

These two patches resolve two instances of -Wstrict-prototypes with newer versions of clang that are present in 5.4. The main Makefile makes this a hard error.

The first patch is upstream commit 63617d8b125e ("drm/amdkfd: add missing void argument to function kgd2kfd_init"), which showed up in 5.5.

The second patch has no upstream equivalent, as the code in question was removed in commit e392c887df97 ("drm/amdkfd: Use array to probe kfd2kgd_calls") upstream, which is part of a larger series that did not look reasonable for stable. I opted to just fix the warning in the same manner as the prior patch, which is less risky and accomplishes the same end result of no warning.

Colin Ian King (1):
drm/amdkfd: add missing void argument to function kgd2kfd_init

Nathan Chancellor (1):
drm/amdkfd: Fix -Wstrict-prototypes from

Quoted 11 lines
    amdgpu_amdkfd_gfx_10_0_get_functions()
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c | 2 +-
 drivers/gpu/drm/amd/amdkfd/kfd_module.c            | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

base-commit: 2845ff3fd34499603249676495c524a35e795b45

Signature · 1 line
2.35.1

Now queued up, thanks.

greg k-h