Skip to contentSkip to conversation

drm/exynos: Fix return type for mixer_mode_valid and hdmi_mode_valid

PATCH In review Nathan Huckleberry 2 participants 2 messages Sep 13, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/exynos: Fix return type for mixer_mode_valid and hdmi_mode_valid

The field mode_valid in exynos_drm_crtc_ops is expected to be of type enum drm_mode_status (*mode_valid)(struct exynos_drm_crtc *crtc,

                                   const struct drm_display_mode *mode);

Likewise for mode_valid in drm_connector_helper_funcs.

The mismatched return type breaks forward edge kCFI since the underlying function definition does not match the function hook definition.

The return type of mixer_mode_valid and hdmi_mode_valid should be changed from int to enum drm_mode_status.

---
 drivers/gpu/drm/exynos/exynos_hdmi.c  | 4 ++--
 drivers/gpu/drm/exynos/exynos_mixer.c | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_hdmi.c +2 -2
index 10b0036f8a2e..8453359c92e8 100644
@@ -922,8 +922,8 @@ static int hdmi_find_phy_conf(struct hdmi_context *hdata, u32 pixel_clock)
 	return -EINVAL;
 }
 
-static int hdmi_mode_valid(struct drm_connector *connector,
-			struct drm_display_mode *mode)
+static enum drm_mode_status hdmi_mode_valid(struct drm_connector *connector,
+					    struct drm_display_mode *mode)
 {
 	struct hdmi_context *hdata = connector_to_hdmi(connector);
 	int ret;
drivers/gpu/drm/exynos/exynos_mixer.c +3 -2
index 65260a658684..82f676e6d21b 100644
@@ -1045,8 +1045,9 @@ static void mixer_atomic_disable(struct exynos_drm_crtc *crtc)
 	clear_bit(MXR_BIT_POWERED, &ctx->flags);
 }
 
-static int mixer_mode_valid(struct exynos_drm_crtc *crtc,
-		const struct drm_display_mode *mode)
+static enum drm_mode_status
+mixer_mode_valid(struct exynos_drm_crtc *crtc,
+		 const struct drm_display_mode *mode)
 {
 	struct mixer_context *ctx = crtc->ctx;
 	u32 w = mode->hdisplay, h = mode->vdisplay;
Signature · 1 line
2.37.2.789.g6183377224-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Nathan Huckleberry

The field mode_valid in exynos_drm_crtc_ops is expected to be of type enum drm_mode_status (*mode_valid)(struct exynos_drm_crtc *crtc,

                                   const struct drm_display_mode *mode);

Likewise for mode_valid in drm_connector_helper_funcs.

The mismatched return type breaks forward edge kCFI since the underlying function definition does not match the function hook definition.

Quoted 7 lines

The return type of mixer_mode_valid and hdmi_mode_valid should be changed from int to enum drm_mode_status.

Quoted 39 lines
---
 drivers/gpu/drm/exynos/exynos_hdmi.c  | 4 ++--
 drivers/gpu/drm/exynos/exynos_mixer.c | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos_hdmi.c +2 -2
index 10b0036f8a2e..8453359c92e8 100644
@@ -922,8 +922,8 @@ static int hdmi_find_phy_conf(struct hdmi_context *hdata, u32 pixel_clock)
 	return -EINVAL;
 }
 
-static int hdmi_mode_valid(struct drm_connector *connector,
-			struct drm_display_mode *mode)
+static enum drm_mode_status hdmi_mode_valid(struct drm_connector *connector,
+					    struct drm_display_mode *mode)
 {
 	struct hdmi_context *hdata = connector_to_hdmi(connector);
 	int ret;
drivers/gpu/drm/exynos/exynos_mixer.c +3 -2
index 65260a658684..82f676e6d21b 100644
@@ -1045,8 +1045,9 @@ static void mixer_atomic_disable(struct exynos_drm_crtc *crtc)
 	clear_bit(MXR_BIT_POWERED, &ctx->flags);
 }
 
-static int mixer_mode_valid(struct exynos_drm_crtc *crtc,
-		const struct drm_display_mode *mode)
+static enum drm_mode_status
+mixer_mode_valid(struct exynos_drm_crtc *crtc,
+		 const struct drm_display_mode *mode)
 {
 	struct mixer_context *ctx = crtc->ctx;
 	u32 w = mode->hdisplay, h = mode->vdisplay;
Signature · 1 line
2.37.2.789.g6183377224-goog