mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/vkms: Add missing check for CRTC initialization
@ 2024-09-06 16:15 Louis Chauvet
  2024-09-17 16:02 ` José Expósito
  2024-09-25  0:02 ` Maíra Canal
  0 siblings, 2 replies; 4+ messages in thread
From: Louis Chauvet @ 2024-09-06 16:15 UTC (permalink / raw)
  To: Rodrigo Siqueira, Maíra Canal, Haneen Mohammed,
	Daniel Vetter, Melissa Wen, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie
  Cc: dri-devel, linux-kernel, thomas.petazzoni, Louis Chauvet

CRTC initialization call drm_mode_crtc_set_gamma_size without the proper
checks, introduce this check to avoid issues.

Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
---
 drivers/gpu/drm/vkms/vkms_crtc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
index 40b4d084e3ce..e4f93dfbd071 100644
--- a/drivers/gpu/drm/vkms/vkms_crtc.c
+++ b/drivers/gpu/drm/vkms/vkms_crtc.c
@@ -287,7 +287,12 @@ int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
 
 	drm_crtc_helper_add(crtc, &vkms_crtc_helper_funcs);
 
-	drm_mode_crtc_set_gamma_size(crtc, VKMS_LUT_SIZE);
+	ret = drm_mode_crtc_set_gamma_size(crtc, VKMS_LUT_SIZE);
+	if (ret) {
+		DRM_ERROR("Failed to set gamma size\n");
+		return ret;
+	}
+
 	drm_crtc_enable_color_mgmt(crtc, 0, false, VKMS_LUT_SIZE);
 
 	spin_lock_init(&vkms_out->lock);

---
base-commit: a6bb1f77a94335de67dba12e7f52651c115b82d2
change-id: 20240906-vkms-add-missing-check-e1b6ee8d1b39

Best regards,
-- 
Louis Chauvet <louis.chauvet@bootlin.com>


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

* [PATCH] drm/vkms: Add missing check for CRTC initialization
  2024-09-06 16:15 [PATCH] drm/vkms: Add missing check for CRTC initialization Louis Chauvet
@ 2024-09-17 16:02 ` José Expósito
  2024-09-18 13:39   ` Louis Chauvet
  2024-09-25  0:02 ` Maíra Canal
  1 sibling, 1 reply; 4+ messages in thread
From: José Expósito @ 2024-09-17 16:02 UTC (permalink / raw)
  To: louis.chauvet
  Cc: airlied, daniel, dri-devel, hamohammed.sa, linux-kernel,
	maarten.lankhorst, mairacanal, melissa.srw, mripard,
	rodrigosiqueiramelo, thomas.petazzoni, tzimmermann,
	José Expósito

Hi Louis,

> CRTC initialization call drm_mode_crtc_set_gamma_size without the proper
> checks, introduce this check to avoid issues.
> 
> Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>

Reviewed-by: José Expósito <jose.exposito89@gmail.com>

> ---
>  drivers/gpu/drm/vkms/vkms_crtc.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> 
> ---
> base-commit: a6bb1f77a94335de67dba12e7f52651c115b82d2
> change-id: 20240906-vkms-add-missing-check-e1b6ee8d1b39
> 
> Best regards,
> 
> diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
> index 40b4d084e3ce..e4f93dfbd071 100644
> --- a/drivers/gpu/drm/vkms/vkms_crtc.c
> +++ b/drivers/gpu/drm/vkms/vkms_crtc.c
> @@ -287,7 +287,12 @@ int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
>  
>  	drm_crtc_helper_add(crtc, &vkms_crtc_helper_funcs);
>  
> -	drm_mode_crtc_set_gamma_size(crtc, VKMS_LUT_SIZE);
> +	ret = drm_mode_crtc_set_gamma_size(crtc, VKMS_LUT_SIZE);
> +	if (ret) {
> +		DRM_ERROR("Failed to set gamma size\n");

This will conflit with "drm/vkms: Switch to dynamic allocation
for CRTC" [1], where you switched to DRM_DEV_ERROR.

No proferences about the log function, just a heads up so when
you rebase one of the patches we keep logging consistent.

[1] https://patchwork.kernel.org/project/dri-devel/patch/20240912-b4-vkms-allocated-v1-3-29abbaa14af9@bootlin.com/

> +		return ret;
> +	}
> +
>  	drm_crtc_enable_color_mgmt(crtc, 0, false, VKMS_LUT_SIZE);
>  
>  	spin_lock_init(&vkms_out->lock);
> 

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

* Re: [PATCH] drm/vkms: Add missing check for CRTC initialization
  2024-09-17 16:02 ` José Expósito
@ 2024-09-18 13:39   ` Louis Chauvet
  0 siblings, 0 replies; 4+ messages in thread
From: Louis Chauvet @ 2024-09-18 13:39 UTC (permalink / raw)
  To: José Expósito
  Cc: airlied, daniel, dri-devel, hamohammed.sa, linux-kernel,
	maarten.lankhorst, mairacanal, melissa.srw, mripard,
	rodrigosiqueiramelo, thomas.petazzoni, tzimmermann

Le 17/09/24 - 18:02, José Expósito a écrit :
> Hi Louis,
> 
> > CRTC initialization call drm_mode_crtc_set_gamma_size without the proper
> > checks, introduce this check to avoid issues.
> > 
> > Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
> 
> Reviewed-by: José Expósito <jose.exposito89@gmail.com>
> 
> > ---
> >  drivers/gpu/drm/vkms/vkms_crtc.c | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > 
> > ---
> > base-commit: a6bb1f77a94335de67dba12e7f52651c115b82d2
> > change-id: 20240906-vkms-add-missing-check-e1b6ee8d1b39
> > 
> > Best regards,
> > 
> > diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
> > index 40b4d084e3ce..e4f93dfbd071 100644
> > --- a/drivers/gpu/drm/vkms/vkms_crtc.c
> > +++ b/drivers/gpu/drm/vkms/vkms_crtc.c
> > @@ -287,7 +287,12 @@ int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
> >  
> >  	drm_crtc_helper_add(crtc, &vkms_crtc_helper_funcs);
> >  
> > -	drm_mode_crtc_set_gamma_size(crtc, VKMS_LUT_SIZE);
> > +	ret = drm_mode_crtc_set_gamma_size(crtc, VKMS_LUT_SIZE);
> > +	if (ret) {
> > +		DRM_ERROR("Failed to set gamma size\n");
> 
> This will conflit with "drm/vkms: Switch to dynamic allocation
> for CRTC" [1], where you switched to DRM_DEV_ERROR.

I did not check if my series had conflict between them, so I'm not 
surprised. I will change it to the DEV variant and send a v2, espicially 
since Leo [1] wants to work to clean the logging in VKMS :-)

[1]:https://lore.kernel.org/all/CAHhBtNqB=jQTnY1eu8or=toczr93ehUeuBkAZ7axFPr4ZHPjCQ@mail.gmail.com/

> No proferences about the log function, just a heads up so when
> you rebase one of the patches we keep logging consistent.
> 
> [1] https://patchwork.kernel.org/project/dri-devel/patch/20240912-b4-vkms-allocated-v1-3-29abbaa14af9@bootlin.com/
> 
> > +		return ret;
> > +	}
> > +
> >  	drm_crtc_enable_color_mgmt(crtc, 0, false, VKMS_LUT_SIZE);
> >  
> >  	spin_lock_init(&vkms_out->lock);
> > 

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

* Re: [PATCH] drm/vkms: Add missing check for CRTC initialization
  2024-09-06 16:15 [PATCH] drm/vkms: Add missing check for CRTC initialization Louis Chauvet
  2024-09-17 16:02 ` José Expósito
@ 2024-09-25  0:02 ` Maíra Canal
  1 sibling, 0 replies; 4+ messages in thread
From: Maíra Canal @ 2024-09-25  0:02 UTC (permalink / raw)
  To: Louis Chauvet, Rodrigo Siqueira, Haneen Mohammed, Daniel Vetter,
	Melissa Wen, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie
  Cc: dri-devel, linux-kernel, thomas.petazzoni

Hi Louis,

On 9/6/24 13:15, Louis Chauvet wrote:
> CRTC initialization call drm_mode_crtc_set_gamma_size without the proper
> checks, introduce this check to avoid issues.
> 
> Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>

Applied to misc/kernel.git (drm-misc-next).

Best Regards,
- Maíra

> ---
>   drivers/gpu/drm/vkms/vkms_crtc.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
> index 40b4d084e3ce..e4f93dfbd071 100644
> --- a/drivers/gpu/drm/vkms/vkms_crtc.c
> +++ b/drivers/gpu/drm/vkms/vkms_crtc.c
> @@ -287,7 +287,12 @@ int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
>   
>   	drm_crtc_helper_add(crtc, &vkms_crtc_helper_funcs);
>   
> -	drm_mode_crtc_set_gamma_size(crtc, VKMS_LUT_SIZE);
> +	ret = drm_mode_crtc_set_gamma_size(crtc, VKMS_LUT_SIZE);
> +	if (ret) {
> +		DRM_ERROR("Failed to set gamma size\n");
> +		return ret;
> +	}
> +
>   	drm_crtc_enable_color_mgmt(crtc, 0, false, VKMS_LUT_SIZE);
>   
>   	spin_lock_init(&vkms_out->lock);
> 
> ---
> base-commit: a6bb1f77a94335de67dba12e7f52651c115b82d2
> change-id: 20240906-vkms-add-missing-check-e1b6ee8d1b39
> 
> Best regards,

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

end of thread, other threads:[~2024-09-25  0:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-06 16:15 [PATCH] drm/vkms: Add missing check for CRTC initialization Louis Chauvet
2024-09-17 16:02 ` José Expósito
2024-09-18 13:39   ` Louis Chauvet
2024-09-25  0:02 ` Maíra Canal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®