Skip to contentSkip to conversation

drm/amd/display: Use memset to initialize variables in fill_plane_dcc_attributes

PATCH Applied Nathan Chancellor 2 participants 2 messages Feb 1, 2019

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

PATCH 1/1 drm/amd/display: Use memset to initialize variables in fill_plane_dcc_attributes

Clang warns:

drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:2314:38:
warning: suggest braces around initialization of subobject [-Wmissing-braces]

        struct dc_surface_dcc_cap output = {0};
                                            ^
                                            {}

Previous efforts to fix this type of warning by adding or removing braces have been met with some pushback in favor of using memset [1][2]. Do that here, mirroring commit 05794eff1aa6 ("drm/amdgpu/gmc: fix compiler errors [-Werror,-Wmissing-braces] (V2)") in this tree.

[1]: https://lore.kernel.org/lkml/[email protected]/
[2]: https://lore.kernel.org/lkml/[email protected]/

Fixes 7df7e505e82a ("drm/amd/display: Set requested plane state DCC params for GFX9")
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +5 -2
index dccad2d207ce..1c1c162c4eee 100644
@@ -2310,12 +2310,15 @@ static bool fill_plane_dcc_attributes(struct amdgpu_device *adev,
 				      uint64_t info)
 {
 	struct dc *dc = adev->dm.dc;
-	struct dc_dcc_surface_param input = {0};
-	struct dc_surface_dcc_cap output = {0};
+	struct dc_dcc_surface_param input;
+	struct dc_surface_dcc_cap output;
 	uint32_t offset = AMDGPU_TILING_GET(info, DCC_OFFSET_256B);
 	uint32_t i64b = AMDGPU_TILING_GET(info, DCC_INDEPENDENT_64B) != 0;
 	uint64_t dcc_address;
 
+	memset(&input, 0, sizeof(input));
+	memset(&output, 0, sizeof(output));
+
 	if (!offset)
 		return false;
 
Signature · 1 line
2.20.1
Applied
#1 lore raw
Quoted 15 lines · Nathan Chancellor

Clang warns:

drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:2314:38:
warning: suggest braces around initialization of subobject [-Wmissing-braces]

        struct dc_surface_dcc_cap output = {0};
                                            ^
                                            {}

Previous efforts to fix this type of warning by adding or removing braces have been met with some pushback in favor of using memset [1][2]. Do that here, mirroring commit 05794eff1aa6 ("drm/amdgpu/gmc: fix compiler errors [-Werror,-Wmissing-braces] (V2)") in this tree.

Quoted 5 lines

[1]: https://lore.kernel.org/lkml/[email protected]/
[2]: https://lore.kernel.org/lkml/[email protected]/

Fixes 7df7e505e82a ("drm/amd/display: Set requested plane state DCC params for GFX9")

Applied all three patches. Thanks!

Alex

Quoted 33 lines
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +5 -3
index dccad2d207ce..1c1c162c4eee 100644
@@ -2310,12 +2310,15 @@ static bool fill_plane_dcc_attributes(struct amdgpu_device *adev,
                                      uint64_t info)
 {
        struct dc *dc = adev->dm.dc;
-       struct dc_dcc_surface_param input = {0};
-       struct dc_surface_dcc_cap output = {0};
+       struct dc_dcc_surface_param input;
+       struct dc_surface_dcc_cap output;
        uint32_t offset = AMDGPU_TILING_GET(info, DCC_OFFSET_256B);
        uint32_t i64b = AMDGPU_TILING_GET(info, DCC_INDEPENDENT_64B) != 0;
        uint64_t dcc_address;
 
+       memset(&input, 0, sizeof(input));
+       memset(&output, 0, sizeof(output));
+
        if (!offset)
                return false;
 
--

2.20.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx