diff mbox series

drm/vmwgfx: Handle possible ENOMEM in vmw_stdu_connector_atomic_check

Message ID 20240809183756.27283-1-ian.forbes@broadcom.com (mailing list archive)
State New, archived
Headers show
Series drm/vmwgfx: Handle possible ENOMEM in vmw_stdu_connector_atomic_check | expand

Commit Message

Ian Forbes Aug. 9, 2024, 6:37 p.m. UTC
Handle unlikely ENOMEN condition and other errors in
vmw_stdu_connector_atomic_check.

Signed-off-by: Ian Forbes <ian.forbes@broadcom.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Fixes: 75c3e8a26a35 ("drm/vmwgfx: Trigger a modeset when the screen moves")
---
 drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Zack Rusin Aug. 13, 2024, 5:07 p.m. UTC | #1
On Fri, Aug 9, 2024 at 2:38 PM Ian Forbes <ian.forbes@broadcom.com> wrote:
>
> Handle unlikely ENOMEN condition and other errors in
> vmw_stdu_connector_atomic_check.
>
> Signed-off-by: Ian Forbes <ian.forbes@broadcom.com>
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Fixes: 75c3e8a26a35 ("drm/vmwgfx: Trigger a modeset when the screen moves")
> ---
>  drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
> index 571e157fe22e9..3223fd278a598 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
> @@ -886,6 +886,10 @@ static int vmw_stdu_connector_atomic_check(struct drm_connector *conn,
>         struct drm_crtc_state *new_crtc_state;
>
>         conn_state = drm_atomic_get_connector_state(state, conn);
> +
> +       if (IS_ERR(conn_state))
> +               return PTR_ERR(conn_state);
> +
>         du = vmw_connector_to_stdu(conn);
>
>         if (!conn_state->crtc)
> --
> 2.34.1
>

Reviewed-by: Zack Rusin <zack.rusin@broadcom.com>

z
Martin Krastev Aug. 19, 2024, 2:38 p.m. UTC | #2
LGTM.

Reviewed-by: Martin Krastev <martin.krastev@broadcom.com>

Regards,
Martin

On Fri, Aug 9, 2024 at 9:38 PM Ian Forbes <ian.forbes@broadcom.com> wrote:
>
> Handle unlikely ENOMEN condition and other errors in
> vmw_stdu_connector_atomic_check.
>
> Signed-off-by: Ian Forbes <ian.forbes@broadcom.com>
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Fixes: 75c3e8a26a35 ("drm/vmwgfx: Trigger a modeset when the screen moves")
> ---
>  drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
> index 571e157fe22e9..3223fd278a598 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
> @@ -886,6 +886,10 @@ static int vmw_stdu_connector_atomic_check(struct drm_connector *conn,
>         struct drm_crtc_state *new_crtc_state;
>
>         conn_state = drm_atomic_get_connector_state(state, conn);
> +
> +       if (IS_ERR(conn_state))
> +               return PTR_ERR(conn_state);
> +
>         du = vmw_connector_to_stdu(conn);
>
>         if (!conn_state->crtc)
> --
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
index 571e157fe22e9..3223fd278a598 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
@@ -886,6 +886,10 @@  static int vmw_stdu_connector_atomic_check(struct drm_connector *conn,
 	struct drm_crtc_state *new_crtc_state;
 
 	conn_state = drm_atomic_get_connector_state(state, conn);
+
+	if (IS_ERR(conn_state))
+		return PTR_ERR(conn_state);
+
 	du = vmw_connector_to_stdu(conn);
 
 	if (!conn_state->crtc)