drm/rockchip: drv: init gem obj for logo memory

less this commit will lead to null pointer, the follwing log is crash at
linux 5.15 version.

[    2.694917] Unable to handle kernel NULL pointer dereference at
virtual address 0000000000000030
[    2.697917] Mem abort info:
[    2.698159]   ESR = 0x96000005
[    2.698426]   EC = 0x25: DABT (current EL), IL = 32 bits
[    2.698896]   SET = 0, FnV = 0
[    2.699170]   EA = 0, S1PTW = 0
[    2.699447]   FSC = 0x05: level 1 translation fault
[    2.699877] Data abort info:
[    2.700129]   ISV = 0, ISS = 0x00000005
[    2.700469]   CM = 0, WnR = 0
[    2.700733] [0000000000000030] user address but active_mm is swapper
[    2.701295] Internal error: Oops: 96000005 [#1] SMP
[    2.701724] Modules linked in:
[    2.701992] CPU: 5 PID: 7 Comm: kworker/u16:0 Tainted: G        W
5.15.0 #1
[    2.702664] Hardware name: Rockchip RK3588 EVB1 LP4 V10 Board (DT)
[    2.703202] Workqueue: events_unbound deferred_probe_work_func
[    2.703711] pstate: 80400009 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS
BTYPE=--)
[    2.704326] pc : drm_gem_plane_helper_prepare_fb+0x34/0x12c
[    2.704821] lr : drm_gem_plane_helper_prepare_fb+0x30/0x12c
[    2.705310] sp : ffffffc011d23710
...
[    2.711873] Call trace:
[    2.712094]  drm_gem_plane_helper_prepare_fb+0x34/0x12c
[    2.712556]  drm_atomic_helper_prepare_planes+0xf8/0x18c
[    2.713021]  drm_atomic_helper_commit+0x70/0x214
[    2.713429]  drm_atomic_commit+0x50/0x5c
[    2.713781]  rockchip_drm_show_logo+0x1580/0x1988
[    2.714201]  rockchip_drm_bind+0x660/0x770
[    2.714563]  try_to_bring_up_master+0x23c/0x2b0
[    2.714959]  __component_add+0xb8/0x18c
[    2.715302]  component_add+0x18/0x20
[    2.715621]  dw_dp_probe+0x654/0x660
[    2.715943]  platform_probe+0xa8/0xd0

Signed-off-by: Sandy Huang <hjc@rock-chips.com>
Change-Id: I7e6b162d5fb093c4a1f2551a01401c6cfba423f5
This commit is contained in:
Sandy Huang
2023-04-07 16:05:23 +08:00
parent b4b55361d6
commit ad404d2920

View File

@@ -38,6 +38,7 @@ static void __rockchip_drm_fb_destroy(struct drm_framebuffer *fb)
#ifndef MODULE
rockchip_free_loader_memory(fb->dev);
#endif
drm_gem_object_release(rockchip_logo_fb->fb.obj[0]);
kfree(rockchip_logo_fb);
} else {
for (i = 0; i < 4; i++) {
@@ -141,6 +142,7 @@ rockchip_drm_logo_fb_alloc(struct drm_device *dev, const struct drm_mode_fb_cmd2
fb->flags |= ROCKCHIP_DRM_MODE_LOGO_FB;
rockchip_logo_fb->logo = logo;
rockchip_logo_fb->fb.obj[0] = &rockchip_logo_fb->rk_obj.base;
drm_gem_object_init(dev, rockchip_logo_fb->fb.obj[0], PAGE_ALIGN(logo->size));
rockchip_logo_fb->rk_obj.dma_addr = logo->dma_addr;
rockchip_logo_fb->rk_obj.kvaddr = logo->kvaddr;
logo->count++;