* [patch] radeon: small memory leak
@ 2010-04-06 10:55 Dan Carpenter
2010-04-06 14:05 ` Matt Turner
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-04-06 10:55 UTC (permalink / raw)
To: David Airlie; +Cc: Alex Deucher, Jerome Glisse, dri-devel
This is an unlikely memory leak, but we may as well fix it. It's easy
to fix and every static checker will complain if we don't.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
index 247f8ee..58845e0 100644
--- a/drivers/gpu/drm/radeon/atom.c
+++ b/drivers/gpu/drm/radeon/atom.c
@@ -1136,6 +1136,7 @@ static int atom_execute_table_locked(struct atom_context *ctx, int index, uint32
int len, ws, ps, ptr;
unsigned char op;
atom_exec_context ectx;
+ int ret = 0;
if (!base)
return -EINVAL;
@@ -1168,7 +1169,8 @@ static int atom_execute_table_locked(struct atom_context *ctx, int index, uint32
if (ectx.abort) {
DRM_ERROR("atombios stuck executing %04X (len %d, WS %d, PS %d) @ 0x%04X\n",
base, len, ws, ps, ptr - 1);
- return -EINVAL;
+ ret = -EINVAL;
+ goto free;
}
if (op < ATOM_OP_CNT && op > 0)
@@ -1183,9 +1185,10 @@ static int atom_execute_table_locked(struct atom_context *ctx, int index, uint32
debug_depth--;
SDEBUG("<<\n");
+free:
if (ws)
kfree(ectx.ws);
- return 0;
+ return ret;
}
int atom_execute_table(struct atom_context *ctx, int index, uint32_t * params)
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
--
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] radeon: small memory leak
2010-04-06 10:55 [patch] radeon: small memory leak Dan Carpenter
@ 2010-04-06 14:05 ` Matt Turner
0 siblings, 0 replies; 2+ messages in thread
From: Matt Turner @ 2010-04-06 14:05 UTC (permalink / raw)
To: Dan Carpenter; +Cc: David Airlie, Alex Deucher, Jerome Glisse, dri-devel
On Tue, Apr 6, 2010 at 6:55 AM, Dan Carpenter <error27@gmail.com> wrote:
> This is an unlikely memory leak, but we may as well fix it. It's easy
> to fix and every static checker will complain if we don't.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
>
> diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
> index 247f8ee..58845e0 100644
> --- a/drivers/gpu/drm/radeon/atom.c
> +++ b/drivers/gpu/drm/radeon/atom.c
> @@ -1136,6 +1136,7 @@ static int atom_execute_table_locked(struct atom_context *ctx, int index, uint32
> int len, ws, ps, ptr;
> unsigned char op;
> atom_exec_context ectx;
> + int ret = 0;
>
> if (!base)
> return -EINVAL;
> @@ -1168,7 +1169,8 @@ static int atom_execute_table_locked(struct atom_context *ctx, int index, uint32
> if (ectx.abort) {
> DRM_ERROR("atombios stuck executing %04X (len %d, WS %d, PS %d) @ 0x%04X\n",
> base, len, ws, ps, ptr - 1);
> - return -EINVAL;
> + ret = -EINVAL;
> + goto free;
> }
>
> if (op < ATOM_OP_CNT && op > 0)
> @@ -1183,9 +1185,10 @@ static int atom_execute_table_locked(struct atom_context *ctx, int index, uint32
> debug_depth--;
> SDEBUG("<<\n");
>
> +free:
> if (ws)
> kfree(ectx.ws);
> - return 0;
> + return ret;
> }
>
> int atom_execute_table(struct atom_context *ctx, int index, uint32_t * params)
>
Looks good.
Reviewed-by: Matt Turner <mattst88@gmail.com>
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
--
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-04-06 14:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-06 10:55 [patch] radeon: small memory leak Dan Carpenter
2010-04-06 14:05 ` Matt Turner
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.