diff options
author | Dave Airlie <airlied@redhat.com> | 2009-11-30 18:13:40 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-12-01 20:37:16 -0500 |
commit | 4b30b87042aa71ed8682e4df622a10456796fccd (patch) | |
tree | e7795fabed90dbc7e2155a48c01dafb4fb1a463d /drivers/gpu | |
parent | 7dde8a19656ddec769b609e8b5662aa7243b8b6a (diff) |
drm/radeon/kms: fix divide by 0 in clocks code
If the chip isn't initialised properly this can happen.
also fix return value in combios clocks function.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_clocks.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_combios.c | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_clocks.c b/drivers/gpu/drm/radeon/radeon_clocks.c index a81354167621..2c541e08f160 100644 --- a/drivers/gpu/drm/radeon/radeon_clocks.c +++ b/drivers/gpu/drm/radeon/radeon_clocks.c | |||
@@ -44,6 +44,10 @@ uint32_t radeon_legacy_get_engine_clock(struct radeon_device *rdev) | |||
44 | 44 | ||
45 | ref_div = | 45 | ref_div = |
46 | RREG32_PLL(RADEON_M_SPLL_REF_FB_DIV) & RADEON_M_SPLL_REF_DIV_MASK; | 46 | RREG32_PLL(RADEON_M_SPLL_REF_FB_DIV) & RADEON_M_SPLL_REF_DIV_MASK; |
47 | |||
48 | if (ref_div == 0) | ||
49 | return 0; | ||
50 | |||
47 | sclk = fb_div / ref_div; | 51 | sclk = fb_div / ref_div; |
48 | 52 | ||
49 | post_div = RREG32_PLL(RADEON_SCLK_CNTL) & RADEON_SCLK_SRC_SEL_MASK; | 53 | post_div = RREG32_PLL(RADEON_SCLK_CNTL) & RADEON_SCLK_SRC_SEL_MASK; |
@@ -70,6 +74,10 @@ static uint32_t radeon_legacy_get_memory_clock(struct radeon_device *rdev) | |||
70 | 74 | ||
71 | ref_div = | 75 | ref_div = |
72 | RREG32_PLL(RADEON_M_SPLL_REF_FB_DIV) & RADEON_M_SPLL_REF_DIV_MASK; | 76 | RREG32_PLL(RADEON_M_SPLL_REF_FB_DIV) & RADEON_M_SPLL_REF_DIV_MASK; |
77 | |||
78 | if (ref_div == 0) | ||
79 | return 0; | ||
80 | |||
73 | mclk = fb_div / ref_div; | 81 | mclk = fb_div / ref_div; |
74 | 82 | ||
75 | post_div = RREG32_PLL(RADEON_MCLK_CNTL) & 0x7; | 83 | post_div = RREG32_PLL(RADEON_MCLK_CNTL) & 0x7; |
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index adc47437569e..14d3555e4afe 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c | |||
@@ -495,7 +495,7 @@ bool radeon_combios_get_clock_info(struct drm_device *dev) | |||
495 | uint16_t sclk, mclk; | 495 | uint16_t sclk, mclk; |
496 | 496 | ||
497 | if (rdev->bios == NULL) | 497 | if (rdev->bios == NULL) |
498 | return NULL; | 498 | return false; |
499 | 499 | ||
500 | pll_info = combios_get_table_offset(dev, COMBIOS_PLL_INFO_TABLE); | 500 | pll_info = combios_get_table_offset(dev, COMBIOS_PLL_INFO_TABLE); |
501 | if (pll_info) { | 501 | if (pll_info) { |