diff mbox series

[05/12] gpu/drm: Ingenic: Fix opaque pointer casted to wrong type

Message ID 20200516215057.392609-5-paul@crapouillou.net (mailing list archive)
State New, archived
Headers show
Series [01/12] dt-bindings: display: Convert ingenic,lcd.txt to YAML | expand

Commit Message

Paul Cercueil May 16, 2020, 9:50 p.m. UTC
The opaque pointer passed to the IRQ handler is a pointer to the
drm_device, not a pointer to our ingenic_drm structure.

It still worked, because our ingenic_drm structure contains the
drm_device as its first field, so the pointer received had the same
value, but this was not semantically correct.

Cc: stable@vger.kernel.org # v5.3
Fixes: 90b86fcc47b4 ("DRM: Add KMS driver for the Ingenic JZ47xx SoCs")
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/gpu/drm/ingenic/ingenic-drm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sam Ravnborg May 17, 2020, 6:21 a.m. UTC | #1
On Sat, May 16, 2020 at 11:50:50PM +0200, Paul Cercueil wrote:
> The opaque pointer passed to the IRQ handler is a pointer to the
> drm_device, not a pointer to our ingenic_drm structure.
> 
> It still worked, because our ingenic_drm structure contains the
> drm_device as its first field, so the pointer received had the same
> value, but this was not semantically correct.
> 
> Cc: stable@vger.kernel.org # v5.3
> Fixes: 90b86fcc47b4 ("DRM: Add KMS driver for the Ingenic JZ47xx SoCs")
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
> ---
>  drivers/gpu/drm/ingenic/ingenic-drm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/ingenic/ingenic-drm.c b/drivers/gpu/drm/ingenic/ingenic-drm.c
> index 0c472382a08b..97244462599b 100644
> --- a/drivers/gpu/drm/ingenic/ingenic-drm.c
> +++ b/drivers/gpu/drm/ingenic/ingenic-drm.c
> @@ -476,7 +476,7 @@ static int ingenic_drm_encoder_atomic_check(struct drm_encoder *encoder,
>  
>  static irqreturn_t ingenic_drm_irq_handler(int irq, void *arg)
>  {
> -	struct ingenic_drm *priv = arg;
> +	struct ingenic_drm *priv = drm_device_get_priv(arg);
>  	unsigned int state;
>  
>  	regmap_read(priv->map, JZ_REG_LCD_STATE, &state);
> -- 
> 2.26.2
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Paul Cercueil May 17, 2020, 12:19 p.m. UTC | #2
Hi Sam,

Le dim. 17 mai 2020 à 8:21, Sam Ravnborg <sam@ravnborg.org> a écrit :
> On Sat, May 16, 2020 at 11:50:50PM +0200, Paul Cercueil wrote:
>>  The opaque pointer passed to the IRQ handler is a pointer to the
>>  drm_device, not a pointer to our ingenic_drm structure.
>> 
>>  It still worked, because our ingenic_drm structure contains the
>>  drm_device as its first field, so the pointer received had the same
>>  value, but this was not semantically correct.
>> 
>>  Cc: stable@vger.kernel.org # v5.3
>>  Fixes: 90b86fcc47b4 ("DRM: Add KMS driver for the Ingenic JZ47xx 
>> SoCs")
>>  Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> Acked-by: Sam Ravnborg <sam@ravnborg.org>

Pushed to drm-misc-fixes, thanks for the review.

-Paul

>>  ---
>>   drivers/gpu/drm/ingenic/ingenic-drm.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>>  diff --git a/drivers/gpu/drm/ingenic/ingenic-drm.c 
>> b/drivers/gpu/drm/ingenic/ingenic-drm.c
>>  index 0c472382a08b..97244462599b 100644
>>  --- a/drivers/gpu/drm/ingenic/ingenic-drm.c
>>  +++ b/drivers/gpu/drm/ingenic/ingenic-drm.c
>>  @@ -476,7 +476,7 @@ static int 
>> ingenic_drm_encoder_atomic_check(struct drm_encoder *encoder,
>> 
>>   static irqreturn_t ingenic_drm_irq_handler(int irq, void *arg)
>>   {
>>  -	struct ingenic_drm *priv = arg;
>>  +	struct ingenic_drm *priv = drm_device_get_priv(arg);
>>   	unsigned int state;
>> 
>>   	regmap_read(priv->map, JZ_REG_LCD_STATE, &state);
>>  --
>>  2.26.2
>> 
>>  _______________________________________________
>>  dri-devel mailing list
>>  dri-devel@lists.freedesktop.org
>>  https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/ingenic/ingenic-drm.c b/drivers/gpu/drm/ingenic/ingenic-drm.c
index 0c472382a08b..97244462599b 100644
--- a/drivers/gpu/drm/ingenic/ingenic-drm.c
+++ b/drivers/gpu/drm/ingenic/ingenic-drm.c
@@ -476,7 +476,7 @@  static int ingenic_drm_encoder_atomic_check(struct drm_encoder *encoder,
 
 static irqreturn_t ingenic_drm_irq_handler(int irq, void *arg)
 {
-	struct ingenic_drm *priv = arg;
+	struct ingenic_drm *priv = drm_device_get_priv(arg);
 	unsigned int state;
 
 	regmap_read(priv->map, JZ_REG_LCD_STATE, &state);