Fix divide-by-zero in nouveau driver (rhbz #747129)

This commit is contained in:
Chuck Ebbert 2011-10-19 00:39:47 -04:00
parent 4933c2453d
commit 5cfb71ce9c
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,24 @@
diff --git a/drivers/gpu/drm/nouveau/nv40_pm.c b/drivers/gpu/drm/nouveau/nv40_pm.c
index 9b5cbb4..73dfdff 100644
--- a/drivers/gpu/drm/nouveau/nv40_pm.c
+++ b/drivers/gpu/drm/nouveau/nv40_pm.c
@@ -57,12 +57,14 @@ read_pll_2(struct drm_device *dev, u32 reg)
int P = (ctrl & 0x00070000) >> 16;
u32 ref = 27000, clk = 0;
- if (ctrl & 0x80000000)
+ if ((ctrl & 0x80000000) && M1) {
clk = ref * N1 / M1;
-
- if (!(ctrl & 0x00000100)) {
- if (ctrl & 0x40000000)
- clk = clk * N2 / M2;
+ if ((ctrl & 0x40000100) == 0x40000000) {
+ if (M2)
+ clk = clk * N2 / M2;
+ else
+ clk = 0;
+ }
}
return clk >> P;

View File

@ -680,6 +680,8 @@ Patch1500: fix_xen_guest_on_old_EC2.patch
# nouveau + drm fixes
Patch1810: drm-nouveau-updates.patch
# fix divide by zero (rhbz #747129)
Patch1811: drm-nouveau-updates-fix-nv40-pm.patch
# intel drm is all merged upstream
Patch1824: drm-intel-next.patch
# make sure the lvds comes back on lid open
@ -1320,6 +1322,8 @@ ApplyPatch fix_xen_guest_on_old_EC2.patch
# Nouveau DRM
ApplyOptionalPatch drm-nouveau-updates.patch
# fix divide by zero (rhbz #747129)
ApplyPatch drm-nouveau-updates-fix-nv40-pm.patch
# Intel DRM
ApplyOptionalPatch drm-intel-next.patch
@ -2084,6 +2088,9 @@ fi
# and build.
%changelog
* Wed Oct 19 2011 Chuck Ebbert <cebbert@redhat.com> 3.1.0-0.rc10.git0.1
- Fix divide-by-zero in nouveau driver (rhbz #747129)
* Tue Oct 18 2011 Chuck Ebbert <cebbert@redhat.com>
- Fix lock inversion causing hangs in 3.1-rc9 (rhbz #746485)
- Linux 3.1-rc10