Re: drivers/gpu/drm/radeon/r100.c:3303]: (style) Redundant condition

From: Alex Deucher
Date: Wed Mar 29 2017 - 18:10:06 EST


On Mon, Mar 27, 2017 at 6:07 AM, David Binderman <dcb314@xxxxxxxxxxx> wrote:
>
> Hello there,
>
> linux-4.11-rc4/drivers/gpu/drm/radeon/r100.c:3303]: (style) Redundant condition: If 'EXPR == 11', the comparison 'EXPR <= 12' is always true.
>
> Source code is
>
> } else if (rdev->family == CHIP_RV350 ||
> rdev->family <= CHIP_RV380) {
>

Fixed in the attached patch.


> Also in the same file:
>
> [drivers/gpu/drm/radeon/r100.c:2550]: (style) Variable 'tmp' is assigned a value
> that is never used.
> [drivers/gpu/drm/radeon/r100.c:2875]: (style) Variable 'tmp' is assigned a value
> that is never used.

These are intended. The registers are read back to to post the previous write.

Alex
From bc02be56efa4c147622c69cfc2772b9a116ab5f9 Mon Sep 17 00:00:00 2001
From: Alex Deucher <alexander.deucher@xxxxxxx>
Date: Wed, 29 Mar 2017 18:03:27 -0400
Subject: [PATCH] drm/radeon: fix typo in bandwidth calculation

The RV3xx settings were getting applied to all older asics
rather than just RV3xx.

Reported-by: David Binderman <dcb314@xxxxxxxxxxx>
Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
---
drivers/gpu/drm/radeon/r100.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index e339931..8344945 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -3301,7 +3301,7 @@ void r100_bandwidth_update(struct radeon_device *rdev)
mem_trp = ((temp >> 8) & 0x7) + 1;
mem_tras = ((temp >> 11) & 0xf) + 4;
} else if (rdev->family == CHIP_RV350 ||
- rdev->family <= CHIP_RV380) {
+ rdev->family == CHIP_RV380) {
/* rv3x0 */
mem_trcd = (temp & 0x7) + 3;
mem_trp = ((temp >> 8) & 0x7) + 3;
--
2.5.5