Commit 9b2788db authored by Dave Airlie's avatar Dave Airlie

Merge tag 'drm-misc-next-fixes-2021-04-29' of...

Merge tag 'drm-misc-next-fixes-2021-04-29' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

Two patches in drm-misc-next-fixes this week, one to fix the error
handling in TTM when a BO can't be swapped out and one to prevent a
wrong dereference in efifb.
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>

From: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20210429090308.k3fuqvenf6vupfmg@gilmour
parents 12fc11bc 74deef03
...@@ -112,7 +112,7 @@ int ttm_global_swapout(struct ttm_operation_ctx *ctx, gfp_t gfp_flags) ...@@ -112,7 +112,7 @@ int ttm_global_swapout(struct ttm_operation_ctx *ctx, gfp_t gfp_flags)
{ {
struct ttm_global *glob = &ttm_glob; struct ttm_global *glob = &ttm_glob;
struct ttm_device *bdev; struct ttm_device *bdev;
int ret = -EBUSY; int ret = 0;
mutex_lock(&ttm_global_mutex); mutex_lock(&ttm_global_mutex);
list_for_each_entry(bdev, &glob->device_list, device_list) { list_for_each_entry(bdev, &glob->device_list, device_list) {
......
...@@ -329,6 +329,8 @@ int ttm_tt_populate(struct ttm_device *bdev, ...@@ -329,6 +329,8 @@ int ttm_tt_populate(struct ttm_device *bdev,
ttm_dma32_pages_limit) { ttm_dma32_pages_limit) {
ret = ttm_global_swapout(ctx, GFP_KERNEL); ret = ttm_global_swapout(ctx, GFP_KERNEL);
if (ret == 0)
break;
if (ret < 0) if (ret < 0)
goto error; goto error;
} }
......
...@@ -280,7 +280,7 @@ static void ttm_shrink(struct ttm_mem_global *glob, bool from_wq, ...@@ -280,7 +280,7 @@ static void ttm_shrink(struct ttm_mem_global *glob, bool from_wq,
spin_unlock(&glob->lock); spin_unlock(&glob->lock);
ret = ttm_global_swapout(ctx, GFP_KERNEL); ret = ttm_global_swapout(ctx, GFP_KERNEL);
spin_lock(&glob->lock); spin_lock(&glob->lock);
if (unlikely(ret < 0)) if (unlikely(ret <= 0))
break; break;
} }
......
...@@ -575,7 +575,8 @@ static int efifb_probe(struct platform_device *dev) ...@@ -575,7 +575,8 @@ static int efifb_probe(struct platform_device *dev)
goto err_fb_dealoc; goto err_fb_dealoc;
} }
fb_info(info, "%s frame buffer device\n", info->fix.id); fb_info(info, "%s frame buffer device\n", info->fix.id);
pm_runtime_get_sync(&efifb_pci_dev->dev); if (efifb_pci_dev)
pm_runtime_get_sync(&efifb_pci_dev->dev);
return 0; return 0;
err_fb_dealoc: err_fb_dealoc:
...@@ -602,7 +603,8 @@ static int efifb_remove(struct platform_device *pdev) ...@@ -602,7 +603,8 @@ static int efifb_remove(struct platform_device *pdev)
unregister_framebuffer(info); unregister_framebuffer(info);
sysfs_remove_groups(&pdev->dev.kobj, efifb_groups); sysfs_remove_groups(&pdev->dev.kobj, efifb_groups);
framebuffer_release(info); framebuffer_release(info);
pm_runtime_put(&efifb_pci_dev->dev); if (efifb_pci_dev)
pm_runtime_put(&efifb_pci_dev->dev);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment