Skip to contentSkip to conversation

drm/mgag200: fix a test in mga_vga_mode_valid()

PATCH In review Dan Carpenter 2 participants 2 messages Jan 25, 2018 – Jan 30, 2018

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

PATCH 1/1 drm/mgag200: fix a test in mga_vga_mode_valid()

The parentheses are in the wrong place here so we pass the bits per pixel as zero.

Fixes abbee6238775 ("drm/mgag200: Added resolution and bandwidth limits for various G200e products.")

---
Static analysis. Not tested.

drivers/gpu/drm/mgag200/mgag200_mode.c +2 -2
index 68e5d9c94475..fb50a9ddaae8 100644
@@ -1620,8 +1620,8 @@ static int mga_vga_mode_valid(struct drm_connector *connector,
 			return MODE_VIRTUAL_X;
 		if (mode->vdisplay > 1024)
 			return MODE_VIRTUAL_Y;
-		if (mga_vga_calculate_mode_bandwidth(mode,
-			bpp > (31877 * 1024)))
+		if (mga_vga_calculate_mode_bandwidth(mode, bpp) >
+		    (31877 * 1024))
 			return MODE_BANDWIDTH;
 	} else if (mdev->type == G200_EV &&
 		(mga_vga_calculate_mode_bandwidth(mode, bpp)
#1 lore raw
Quoted 7 lines · Dan Carpenter

The parentheses are in the wrong place here so we pass the bits per pixel as zero.

Fixes abbee6238775 ("drm/mgag200: Added resolution and bandwidth limits for various G200e products.")

---
Static analysis. Not tested.

Looks reasonable. Thanks for the patch, applied.
-Daniel

Quoted 16 lines
drivers/gpu/drm/mgag200/mgag200_mode.c +2 -2
index 68e5d9c94475..fb50a9ddaae8 100644
@@ -1620,8 +1620,8 @@ static int mga_vga_mode_valid(struct drm_connector *connector,
 			return MODE_VIRTUAL_X;
 		if (mode->vdisplay > 1024)
 			return MODE_VIRTUAL_Y;
-		if (mga_vga_calculate_mode_bandwidth(mode,
-			bpp > (31877 * 1024)))
+		if (mga_vga_calculate_mode_bandwidth(mode, bpp) >
+		    (31877 * 1024))
 			return MODE_BANDWIDTH;
 	} else if (mdev->type == G200_EV &&
 		(mga_vga_calculate_mode_bandwidth(mode, bpp)
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch