diff options
author | Arnd Bergmann <arnd@arndb.de> | 2018-01-16 08:44:50 -0500 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2018-02-02 00:24:10 -0500 |
commit | b515483e12b81da8cb62f1ff2461d6c29cf5115f (patch) | |
tree | 5dee7227e9803bdecd66aaea4382d9dde848020e /drivers/gpu/drm | |
parent | e64fe9db2d1a31f6475ab1d5758860e7aa0cbb88 (diff) |
drm/nouveau/clk: fix gcc-7 -Wint-in-bool-context warning
gcc thinks that interpreting a multiplication result as a bool
is confusing:
drivers/gpu/drm/nouveau/nvkm/subdev/clk/gt215.c: In function 'read_pll':
drivers/gpu/drm/nouveau/nvkm/subdev/clk/gt215.c:133:8: error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context]
Adding a temporary variable to contain the divisor helps make
it clear what is going on and avoids that warning.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/subdev/clk/gt215.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gt215.c b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gt215.c index 96e0941c8edd..f0a26881d9b9 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gt215.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gt215.c | |||
@@ -110,6 +110,7 @@ read_pll(struct gt215_clk *clk, int idx, u32 pll) | |||
110 | struct nvkm_device *device = clk->base.subdev.device; | 110 | struct nvkm_device *device = clk->base.subdev.device; |
111 | u32 ctrl = nvkm_rd32(device, pll + 0); | 111 | u32 ctrl = nvkm_rd32(device, pll + 0); |
112 | u32 sclk = 0, P = 1, N = 1, M = 1; | 112 | u32 sclk = 0, P = 1, N = 1, M = 1; |
113 | u32 MP; | ||
113 | 114 | ||
114 | if (!(ctrl & 0x00000008)) { | 115 | if (!(ctrl & 0x00000008)) { |
115 | if (ctrl & 0x00000001) { | 116 | if (ctrl & 0x00000001) { |
@@ -130,10 +131,12 @@ read_pll(struct gt215_clk *clk, int idx, u32 pll) | |||
130 | sclk = read_clk(clk, 0x10 + idx, false); | 131 | sclk = read_clk(clk, 0x10 + idx, false); |
131 | } | 132 | } |
132 | 133 | ||
133 | if (M * P) | 134 | MP = M * P; |
134 | return sclk * N / (M * P); | ||
135 | 135 | ||
136 | return 0; | 136 | if (!MP) |
137 | return 0; | ||
138 | |||
139 | return sclk * N / MP; | ||
137 | } | 140 | } |
138 | 141 | ||
139 | static int | 142 | static int |