Skip to content

Commit cec9e59

Browse files
nhukcpinchartl
authored andcommitted
drm: xlnx: Fix return type of zynqmp_dp_bridge_mode_valid
The mode_valid field in drm_bridge_helper_funcs is expected to be of type enum drm_mode_status (* mode_valid) (struct drm_bridge *bridge, struct drm_display_mode *mode); The mismatched return type breaks forward edge kCFI since the underlying function definition does not match the function hook definition. A new warning in clang will catch this at compile time: drivers/gpu/drm/xlnx/zynqmp_dp.c:1573:16: error: incompatible function pointer types initializing 'enum drm_mode_status (*)(struct drm_bridge *, const struct drm_display_info *, const struct drm_display_mode *)' with an expression of type 'int (struct drm_bridge *, const struct drm_display_info *, const struct drm_display_mode *)' [-Werror,-Wincompatible-function-pointer-types-strict] .mode_valid = zynqmp_dp_bridge_mode_valid, ^~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. The return type of zynqmp_dp_bridge_mode_valid should be changed from int to enum drm_mode_status. Reported-by: Dan Carpenter <[email protected]> Link: ClangBuiltLinux#1703 Link: ClangBuiltLinux#1750 Signed-off-by: Nathan Huckleberry <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> [nathan: Rebase on drm-misc-next and fix conflicts Add note about new clang warning] Signed-off-by: Nathan Chancellor <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]>
1 parent 418bb3a commit cec9e59

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/gpu/drm/xlnx/zynqmp_dp.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,9 +1362,10 @@ static void zynqmp_dp_bridge_detach(struct drm_bridge *bridge)
13621362
zynqmp_dp_aux_cleanup(dp);
13631363
}
13641364

1365-
static int zynqmp_dp_bridge_mode_valid(struct drm_bridge *bridge,
1366-
const struct drm_display_info *info,
1367-
const struct drm_display_mode *mode)
1365+
static enum drm_mode_status
1366+
zynqmp_dp_bridge_mode_valid(struct drm_bridge *bridge,
1367+
const struct drm_display_info *info,
1368+
const struct drm_display_mode *mode)
13681369
{
13691370
struct zynqmp_dp *dp = bridge_to_dp(bridge);
13701371
int rate;

0 commit comments

Comments
 (0)