Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b515483e authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Ben Skeggs
Browse files

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: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent e64fe9db
Loading
Loading
Loading
Loading
+6 −3
Original line number Original line Diff line number Diff line
@@ -110,6 +110,7 @@ read_pll(struct gt215_clk *clk, int idx, u32 pll)
	struct nvkm_device *device = clk->base.subdev.device;
	struct nvkm_device *device = clk->base.subdev.device;
	u32 ctrl = nvkm_rd32(device, pll + 0);
	u32 ctrl = nvkm_rd32(device, pll + 0);
	u32 sclk = 0, P = 1, N = 1, M = 1;
	u32 sclk = 0, P = 1, N = 1, M = 1;
	u32 MP;


	if (!(ctrl & 0x00000008)) {
	if (!(ctrl & 0x00000008)) {
		if (ctrl & 0x00000001) {
		if (ctrl & 0x00000001) {
@@ -130,10 +131,12 @@ read_pll(struct gt215_clk *clk, int idx, u32 pll)
		sclk = read_clk(clk, 0x10 + idx, false);
		sclk = read_clk(clk, 0x10 + idx, false);
	}
	}


	if (M * P)
	MP = M * P;
		return sclk * N / (M * P);


	if (!MP)
		return 0;
		return 0;

	return sclk * N / MP;
}
}


static int
static int