drm/edid: Use ARRAY_SIZE in drm_add_modes_noedid

This change “drm/edid: Use ARRAY_SIZE in drm_add_modes_noedid” in Linux kernel is authored by Daniel Vetter <daniel.vetter [at] ffwll.ch> on Mon Aug 10 11:55:37 2015 +0200.

drm/edid: Use ARRAY_SIZE in drm_add_modes_noedid

Spotted while reading code for random reasons.

Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>

This Linux change may have been applied to various maintained Linux releases and you can find Linux releases including commit fbb40b2.

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/gpu/drm/drm_edid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index e6e05bb..05bb731 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -3802,7 +3802,7 @@ int drm_add_modes_noedid(struct drm_connector *connector,
 	struct drm_display_mode *mode;
 	struct drm_device *dev = connector->dev;
 
-	count = sizeof(drm_dmt_modes) / sizeof(struct drm_display_mode);
+	count = ARRAY_SIZE(drm_dmt_modes);
 	if (hdisplay < 0)
 		hdisplay = 0;
 	if (vdisplay < 0)

The commit for this change in Linux stable tree is fbb40b2 (patch).

Leave a Reply

Your email address will not be published. Required fields are marked *