Skip to contentSkip to conversation

drm/amd/display: use ARRAY_SIZE for base60_refresh_rates

PATCH Applied Jiapeng Chong 2 participants 2 messages Jun 9, 2021

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

PATCH 1/1 drm/amd/display: use ARRAY_SIZE for base60_refresh_rates

Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element.

Clean up the following coccicheck warning:

./drivers/gpu/drm/amd/display/dc/core/dc_resource.c:448:47-48: WARNING:
Use ARRAY_SIZE.

---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +1 -1
index 57afe71..3f00989 100644
@@ -445,7 +445,7 @@ bool resource_are_vblanks_synchronizable(
 {
 	uint32_t base60_refresh_rates[] = {10, 20, 5};
 	uint8_t i;
-	uint8_t rr_count = sizeof(base60_refresh_rates)/sizeof(base60_refresh_rates[0]);
+	uint8_t rr_count = ARRAY_SIZE(base60_refresh_rates);
 	uint64_t frame_time_diff;
 
 	if (stream1->ctx->dc->config.vblank_alignment_dto_params &&
Signature · 1 line
1.8.3.1
Applied
#1 lore raw

Applied. Thanks!

Quoted 29 lines · Jiapeng Chong

Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element.

Clean up the following coccicheck warning:

./drivers/gpu/drm/amd/display/dc/core/dc_resource.c:448:47-48: WARNING:
Use ARRAY_SIZE.

---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +1 -2
index 57afe71..3f00989 100644
@@ -445,7 +445,7 @@ bool resource_are_vblanks_synchronizable(
 {
        uint32_t base60_refresh_rates[] = {10, 20, 5};
        uint8_t i;
-       uint8_t rr_count = sizeof(base60_refresh_rates)/sizeof(base60_refresh_rates[0]);
+       uint8_t rr_count = ARRAY_SIZE(base60_refresh_rates);
        uint64_t frame_time_diff;
 
        if (stream1->ctx->dc->config.vblank_alignment_dto_params &&
--
Quoted 2 lines

1.8.3.1

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