drm/edid: make read-only const array static
Subsystems (3)
PATCH 1/1 drm/edid: make read-only const array static
Don't populate the const array on the stack, instead make it static.
Signed-off-by Colin Ian King <[email protected]>
--- drivers/gpu/drm/drm_edid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_edid.c +1 -1
@@ -3962,7 +3962,7 @@ static int drm_cvt_modes(struct drm_connector *connector,struct drm_display_mode *newmode;struct drm_device *dev = connector->dev;const struct cvt_timing *cvt; -const int rates[] = {60 ,85 ,75 ,60 ,50 }; +static const int rates[] = {60 ,85 ,75 ,60 ,50 };const u8 empty[3 ] = {0 ,0 ,0 };for (i =0 ; i <4 ; i++) {
Signature · 1 line
2.39.2
Quoted 3 lines · Colin Ian King
Don't populate the const array on the stack, instead make it static.
Signed-off-by Colin Ian King <[email protected]>
Thanks, pushed to drm-misc-next.
Quoted 9 lines
--- drivers/gpu/drm/drm_edid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/drm_edid.c +0
-0
drivers/gpu/drm/drm_edid.c static int drm_cvt_modes(struct drm_connector *connector, · line 3966
Quoted 6 lines
drivers/gpu/drm/drm_edid.c +1
-1@@ -3962,7 +3962,7 @@ static int drm_cvt_modes(struct drm_connector *connector,struct drm_display_mode *newmode;struct drm_device *dev = connector->dev;const struct cvt_timing *cvt; -const int rates[] = {60 ,85 ,75 ,60 ,50 }; +static const int rates[] = {60 ,85 ,75 ,60 ,50 };const u8 empty[3 ] = {0 ,0 ,0 };
Side note, this could be removed by replacing
if (!memcmp(cvt->code, empty, 3))
with
if (!memchr_inv(cvt->code, 0, 3))
or even
if (!cvt->code[0] && !cvt->code[1] && !cvt->code[2])
BR,
Jani.
Quoted 2 lines
drivers/gpu/drm/drm_edid.c +0
-0for (i =0 ; i <4 ; i++) {
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center