linux-samsung-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/exynos: Fix return type for mixer_mode_valid and hdmi_mode_valid
@ 2022-09-13 20:54 Nathan Huckleberry
  2022-09-13 23:18 ` Nathan Chancellor
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Huckleberry @ 2022-09-13 20:54 UTC (permalink / raw)
  Cc: Nathan Huckleberry, Dan Carpenter, llvm, Inki Dae, Seung-Woo Kim,
	Kyungmin Park, David Airlie, Daniel Vetter, Krzysztof Kozlowski,
	Alim Akhtar, Nathan Chancellor, Nick Desaulniers, Tom Rix,
	dri-devel, linux-arm-kernel, linux-samsung-soc, linux-kernel

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.

Reported-by: Dan Carpenter <error27@gmail.com>
Link: https://github.com/ClangBuiltLinux/linux/issues/1703
Cc: llvm@lists.linux.dev
Signed-off-by: Nathan Huckleberry <nhuck@google.com>
---
 drivers/gpu/drm/exynos/exynos_hdmi.c  | 4 ++--
 drivers/gpu/drm/exynos/exynos_mixer.c | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 10b0036f8a2e..8453359c92e8 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -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;
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index 65260a658684..82f676e6d21b 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -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;
-- 
2.37.2.789.g6183377224-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/exynos: Fix return type for mixer_mode_valid and hdmi_mode_valid
  2022-09-13 20:54 [PATCH] drm/exynos: Fix return type for mixer_mode_valid and hdmi_mode_valid Nathan Huckleberry
@ 2022-09-13 23:18 ` Nathan Chancellor
  0 siblings, 0 replies; 2+ messages in thread
From: Nathan Chancellor @ 2022-09-13 23:18 UTC (permalink / raw)
  To: Nathan Huckleberry
  Cc: Dan Carpenter, llvm, Inki Dae, Seung-Woo Kim, Kyungmin Park,
	David Airlie, Daniel Vetter, Krzysztof Kozlowski, Alim Akhtar,
	Nick Desaulniers, Tom Rix, dri-devel, linux-arm-kernel,
	linux-samsung-soc, linux-kernel

On Tue, Sep 13, 2022 at 01:54:49PM -0700, Nathan Huckleberry wrote:
> 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.
> 
> Reported-by: Dan Carpenter <error27@gmail.com>
> Link: https://github.com/ClangBuiltLinux/linux/issues/1703
> Cc: llvm@lists.linux.dev
> Signed-off-by: Nathan Huckleberry <nhuck@google.com>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
>  drivers/gpu/drm/exynos/exynos_hdmi.c  | 4 ++--
>  drivers/gpu/drm/exynos/exynos_mixer.c | 5 +++--
>  2 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index 10b0036f8a2e..8453359c92e8 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -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;
> diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
> index 65260a658684..82f676e6d21b 100644
> --- a/drivers/gpu/drm/exynos/exynos_mixer.c
> +++ b/drivers/gpu/drm/exynos/exynos_mixer.c
> @@ -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;
> -- 
> 2.37.2.789.g6183377224-goog
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-13 23:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-13 20:54 [PATCH] drm/exynos: Fix return type for mixer_mode_valid and hdmi_mode_valid Nathan Huckleberry
2022-09-13 23:18 ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).