diff mbox series

[5.4,099/453] drm/amdgpu: fix build_coefficients() argument

Message ID 20201228124941.984955049@linuxfoundation.org
State New
Headers show
Series None | expand

Commit Message

Greg KH Dec. 28, 2020, 12:45 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de>


[ Upstream commit dbb60031dd0c2b85f10ce4c12ae604c28d3aaca4 ]

gcc -Wextra warns about a function taking an enum argument
being called with a bool:

drivers/gpu/drm/amd/amdgpu/../display/modules/color/color_gamma.c: In function 'apply_degamma_for_user_regamma':
drivers/gpu/drm/amd/amdgpu/../display/modules/color/color_gamma.c:1617:29: warning: implicit conversion from 'enum <anonymous>' to 'enum dc_transfer_func_predefined' [-Wenum-conversion]
 1617 |  build_coefficients(&coeff, true);

It appears that a patch was added using the old calling conventions
after the type was changed, and the value should actually be 0
(TRANSFER_FUNCTION_SRGB) here instead of 1 (true).

Fixes: 55a01d4023ce ("drm/amd/display: Add user_regamma to color module")
Reviewed-by: Harry Wentland <harry.wentland@amd.com>

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

Signed-off-by: Sasha Levin <sashal@kernel.org>

---
 drivers/gpu/drm/amd/display/modules/color/color_gamma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.27.0

Comments

Pavel Machek Dec. 29, 2020, 5:58 p.m. UTC | #1
Hi!

> From: Arnd Bergmann <arnd@arndb.de>

> 

> [ Upstream commit dbb60031dd0c2b85f10ce4c12ae604c28d3aaca4 ]

> 

> gcc -Wextra warns about a function taking an enum argument

> being called with a bool:

> 

> drivers/gpu/drm/amd/amdgpu/../display/modules/color/color_gamma.c: In function 'apply_degamma_for_user_regamma':

> drivers/gpu/drm/amd/amdgpu/../display/modules/color/color_gamma.c:1617:29: warning: implicit conversion from 'enum <anonymous>' to 'enum dc_transfer_func_predefined' [-Wenum-conversion]

>  1617 |  build_coefficients(&coeff, true);

> 

> It appears that a patch was added using the old calling conventions

> after the type was changed, and the value should actually be 0

> (TRANSFER_FUNCTION_SRGB) here instead of 1 (true).


Yeah, but 4.19 still uses bool there, so this actually introduces a
bug.

Please drop.
								Pavel
								
> +++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c

> @@ -1576,7 +1576,7 @@ static void apply_degamma_for_user_regamma(struct pwl_float_data_ex *rgb_regamma

>  	struct pwl_float_data_ex *rgb = rgb_regamma;

>  	const struct hw_x_point *coord_x = coordinates_x;

>  

> -	build_coefficients(&coeff, true);

> +	build_coefficients(&coeff, TRANSFER_FUNCTION_SRGB);

>  

>  	i = 0;

>  	while (i != hw_points_num + 1) {

> -- 

> 2.27.0

> 

> 


-- 
http://www.livejournal.com/~pavelmachek
Greg KH Dec. 30, 2020, 9:22 a.m. UTC | #2
On Tue, Dec 29, 2020 at 06:58:19PM +0100, Pavel Machek wrote:
> Hi!

> 

> > From: Arnd Bergmann <arnd@arndb.de>

> > 

> > [ Upstream commit dbb60031dd0c2b85f10ce4c12ae604c28d3aaca4 ]

> > 

> > gcc -Wextra warns about a function taking an enum argument

> > being called with a bool:

> > 

> > drivers/gpu/drm/amd/amdgpu/../display/modules/color/color_gamma.c: In function 'apply_degamma_for_user_regamma':

> > drivers/gpu/drm/amd/amdgpu/../display/modules/color/color_gamma.c:1617:29: warning: implicit conversion from 'enum <anonymous>' to 'enum dc_transfer_func_predefined' [-Wenum-conversion]

> >  1617 |  build_coefficients(&coeff, true);

> > 

> > It appears that a patch was added using the old calling conventions

> > after the type was changed, and the value should actually be 0

> > (TRANSFER_FUNCTION_SRGB) here instead of 1 (true).

> 

> Yeah, but 4.19 still uses bool there, so this actually introduces a

> bug.

> 

> Please drop.


Now dropped, thanks.

greg k-h
diff mbox series

Patch

diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
index 51d07a4561ce9..e042d8ce05b4a 100644
--- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
+++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
@@ -1576,7 +1576,7 @@  static void apply_degamma_for_user_regamma(struct pwl_float_data_ex *rgb_regamma
 	struct pwl_float_data_ex *rgb = rgb_regamma;
 	const struct hw_x_point *coord_x = coordinates_x;
 
-	build_coefficients(&coeff, true);
+	build_coefficients(&coeff, TRANSFER_FUNCTION_SRGB);
 
 	i = 0;
 	while (i != hw_points_num + 1) {