[2/2] drm: mcde: Fix forgotten user of drm->dev_private

Message ID 20200613223027.4189309-2-linus.walleij@linaro.org
State New
Headers show
Series
  • [1/2] drm: mcde: Fix display initialization problem
Related show

Commit Message

Linus Walleij June 13, 2020, 10:30 p.m.
We forgot one call site directly using drm->dev_private.
This leads to a crash like this:

8<--- cut here ---
Unable to handle kernel NULL pointer dereference at virtual address 00000918
pgd = (ptrval)
[00000918] *pgd=00000000
Internal error: Oops: 5 [#1] SMP ARM
Modules linked in:
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.7.0-15001-gfa384b50b96b-dirty #514
Hardware name: ST-Ericsson Ux5x0 platform (Device Tree Support)
PC is at mcde_display_enable+0x78/0x7c0
LR is at mcde_display_enable+0x78/0x7c0

Fix this by using to_mcde() as in other functions.

Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Fixes: fd7ee85cfe7b ("drm/mcde: Don't use drm_device->dev_private")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

---
 drivers/gpu/drm/mcde/mcde_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.26.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Comments

Sam Ravnborg June 14, 2020, 7:48 a.m. | #1
On Sun, Jun 14, 2020 at 12:30:27AM +0200, Linus Walleij wrote:
> We forgot one call site directly using drm->dev_private.

> This leads to a crash like this:

> 

> 8<--- cut here ---

> Unable to handle kernel NULL pointer dereference at virtual address 00000918

> pgd = (ptrval)

> [00000918] *pgd=00000000

> Internal error: Oops: 5 [#1] SMP ARM

> Modules linked in:

> CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.7.0-15001-gfa384b50b96b-dirty #514

> Hardware name: ST-Ericsson Ux5x0 platform (Device Tree Support)

> PC is at mcde_display_enable+0x78/0x7c0

> LR is at mcde_display_enable+0x78/0x7c0

> 

> Fix this by using to_mcde() as in other functions.

> 

> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>

> Fixes: fd7ee85cfe7b ("drm/mcde: Don't use drm_device->dev_private")

> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>


This is the last hit for "git grep dev_private".
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>


> ---

>  drivers/gpu/drm/mcde/mcde_display.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/drivers/gpu/drm/mcde/mcde_display.c b/drivers/gpu/drm/mcde/mcde_display.c

> index b319a474f801..212aee60cf61 100644

> --- a/drivers/gpu/drm/mcde/mcde_display.c

> +++ b/drivers/gpu/drm/mcde/mcde_display.c

> @@ -838,7 +838,7 @@ static void mcde_display_enable(struct drm_simple_display_pipe *pipe,

>  	struct drm_crtc *crtc = &pipe->crtc;

>  	struct drm_plane *plane = &pipe->plane;

>  	struct drm_device *drm = crtc->dev;

> -	struct mcde *mcde = drm->dev_private;

> +	struct mcde *mcde = to_mcde(drm);

>  	const struct drm_display_mode *mode = &cstate->mode;

>  	struct drm_framebuffer *fb = plane->state->fb;

>  	u32 format = fb->format->format;

> -- 

> 2.26.2

> 

> _______________________________________________

> dri-devel mailing list

> dri-devel@lists.freedesktop.org

> https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Patch

diff --git a/drivers/gpu/drm/mcde/mcde_display.c b/drivers/gpu/drm/mcde/mcde_display.c
index b319a474f801..212aee60cf61 100644
--- a/drivers/gpu/drm/mcde/mcde_display.c
+++ b/drivers/gpu/drm/mcde/mcde_display.c
@@ -838,7 +838,7 @@  static void mcde_display_enable(struct drm_simple_display_pipe *pipe,
 	struct drm_crtc *crtc = &pipe->crtc;
 	struct drm_plane *plane = &pipe->plane;
 	struct drm_device *drm = crtc->dev;
-	struct mcde *mcde = drm->dev_private;
+	struct mcde *mcde = to_mcde(drm);
 	const struct drm_display_mode *mode = &cstate->mode;
 	struct drm_framebuffer *fb = plane->state->fb;
 	u32 format = fb->format->format;