From b5e9fc13dd0f25a2f422000c185f491bfd4f7335 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 2 Jan 2006 19:23:44 +1100 Subject: drm: fix issue with contexts running out of RAM Signed-off-by: Dave Airlie --- drivers/char/drm/drm_context.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers/char/drm/drm_context.c') diff --git a/drivers/char/drm/drm_context.c b/drivers/char/drm/drm_context.c index bdd168d88f49..7a7bcef2aa84 100644 --- a/drivers/char/drm/drm_context.c +++ b/drivers/char/drm/drm_context.c @@ -432,6 +432,10 @@ int drm_addctx(struct inode *inode, struct file *filp, if (ctx.handle != DRM_KERNEL_CONTEXT) { if (dev->driver->context_ctor) + if (dev->driver->context_ctor(dev, ctx.handle)) { + DRM_DEBUG("Running out of ctxs or memory.\n"); + return -ENOMEM; + } dev->driver->context_ctor(dev, ctx.handle); } -- cgit v1.2.3 From 1e7d51902a8bd08e37113aaf182d12233b157151 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 2 Jan 2006 19:25:35 +1100 Subject: drm: proper fix for drm_context Bad patch in last version Signed-off-by: Dave Airlie --- drivers/char/drm/drm_context.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/char/drm/drm_context.c') diff --git a/drivers/char/drm/drm_context.c b/drivers/char/drm/drm_context.c index 7a7bcef2aa84..f84254526949 100644 --- a/drivers/char/drm/drm_context.c +++ b/drivers/char/drm/drm_context.c @@ -432,11 +432,10 @@ int drm_addctx(struct inode *inode, struct file *filp, if (ctx.handle != DRM_KERNEL_CONTEXT) { if (dev->driver->context_ctor) - if (dev->driver->context_ctor(dev, ctx.handle)) { + if (!dev->driver->context_ctor(dev, ctx.handle)) { DRM_DEBUG("Running out of ctxs or memory.\n"); return -ENOMEM; } - dev->driver->context_ctor(dev, ctx.handle); } ctx_entry = drm_alloc(sizeof(*ctx_entry), DRM_MEM_CTXLIST); -- cgit v1.2.3