[PATCH] Don't test for NULL firmware before releasing

2023-02-16 Thread Jesper Juhl
From 4fe34831e2e7677b1c9616356f0a2e0a36ec092f Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Thu, 16 Feb 2023 02:33:05 +0100 Subject: [PATCH] Don't test for NULL firmware before releasing release_firmware() tests for a NULL pointer itself, no need to do it up-front. Signed-off-by: Jesper

[PATCH] drm/i915: Fix mem leak in intel_sdvo_write_cmd()

2012-08-06 Thread Jesper Juhl
On Sun, 5 Aug 2012, Daniel Vetter wrote: > On Tue, Jul 31, 2012 at 10:31:15PM +0200, Jesper Juhl wrote: > > If the allocation of 'buf' succeeds but the allocation of 'msgs' fails > > we'll return false and leak 'buf' when it goes out of scope. > > > > Signed-off

Re: [PATCH] drm/i915: Fix mem leak in intel_sdvo_write_cmd()

2012-08-05 Thread Jesper Juhl
On Sun, 5 Aug 2012, Daniel Vetter wrote: On Tue, Jul 31, 2012 at 10:31:15PM +0200, Jesper Juhl wrote: If the allocation of 'buf' succeeds but the allocation of 'msgs' fails we'll return false and leak 'buf' when it goes out of scope. Signed-off-by: Jesper Juhl j...@chaosbits.net I've

[PATCH] drm/i915: Fix mem leak in intel_sdvo_write_cmd()

2012-07-31 Thread Jesper Juhl
If the allocation of 'buf' succeeds but the allocation of 'msgs' fails we'll return false and leak 'buf' when it goes out of scope. Signed-off-by: Jesper Juhl --- drivers/gpu/drm/i915/intel_sdvo.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) note: compile tested only due

[PATCH] drm/i915: Fix mem leak in intel_sdvo_write_cmd()

2012-07-31 Thread Jesper Juhl
If the allocation of 'buf' succeeds but the allocation of 'msgs' fails we'll return false and leak 'buf' when it goes out of scope. Signed-off-by: Jesper Juhl j...@chaosbits.net --- drivers/gpu/drm/i915/intel_sdvo.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) note

[PATCH] drm, cirrus_fbdev: Fix leak in cirrusfb_create()

2012-07-20 Thread Jesper Juhl
fails then we'll leak the memory allocated for 'sysram' with vmalloc(). Signed-off-by: Jesper Juhl --- drivers/gpu/drm/cirrus/cirrus_fbdev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/cirrus/cirrus_fbdev.c b/drivers/gpu/drm/cirrus/cirrus_fbdev.c index

[PATCH] drm, ast_fb: Fix a small leak in astfb_create()

2012-07-20 Thread Jesper Juhl
' if the framebuffer_alloc() call fails and the variable goes out of scope. Signed-off-by: Jesper Juhl --- drivers/gpu/drm/ast/ast_fb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/ast/ast_fb.c b/drivers/gpu/drm/ast/ast_fb.c index 2fc8e9e..260a760 100644 --- a/drivers/gpu/drm/ast

[PATCH] drm, ast_fb: Fix a small leak in astfb_create()

2012-07-20 Thread Jesper Juhl
' if the framebuffer_alloc() call fails and the variable goes out of scope. Signed-off-by: Jesper Juhl j...@chaosbits.net --- drivers/gpu/drm/ast/ast_fb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/ast/ast_fb.c b/drivers/gpu/drm/ast/ast_fb.c index 2fc8e9e..260a760 100644

[PATCH] drm, cirrus_fbdev: Fix leak in cirrusfb_create()

2012-07-20 Thread Jesper Juhl
fails then we'll leak the memory allocated for 'sysram' with vmalloc(). Signed-off-by: Jesper Juhl j...@chaosbits.net --- drivers/gpu/drm/cirrus/cirrus_fbdev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/cirrus/cirrus_fbdev.c b/drivers/gpu/drm/cirrus

[PATCH] drm/i915/sprite: Fix mem leak in intel_plane_init()

2012-06-26 Thread Jesper Juhl
If we ever hit the default case in the switch statement we'll return from the function without freeing the memory we just allocated to 'intel_plane' (but that has not been used). This patch gets rid of the leak by freeing the memory just before we return. Signed-off-by: Jesper Juhl j

[PATCH] mgag200: Fix a memory leak in mgag200fb_create()

2012-06-24 Thread Jesper Juhl
On Fri, 22 Jun 2012, devendra.aaru wrote: > On Fri, Jun 22, 2012 at 3:43 AM, Jesper Juhl wrote: > > First we allocate memory for 'sysram' with vmalloc() and subsequently > > we allocate for 'info' with framebuffer_alloc(). If the second > > allocation fails we return

Re: [PATCH] mgag200: Fix a memory leak in mgag200fb_create()

2012-06-24 Thread Jesper Juhl
On Fri, 22 Jun 2012, devendra.aaru wrote: On Fri, Jun 22, 2012 at 3:43 AM, Jesper Juhl j...@chaosbits.net wrote: First we allocate memory for 'sysram' with vmalloc() and subsequently we allocate for 'info' with framebuffer_alloc(). If the second allocation fails we return -ENOMEM

[PATCH] mgag200: Fix a memory leak in mgag200fb_create()

2012-06-22 Thread Jesper Juhl
First we allocate memory for 'sysram' with vmalloc() and subsequently we allocate for 'info' with framebuffer_alloc(). If the second allocation fails we return -ENOMEM, but neglect to vfree() the memory we previously allocated for 'sysram', thus leaking it. Signed-off-by: Jesper Juhl

[PATCH] mgag200: Fix a memory leak in mgag200fb_create()

2012-06-21 Thread Jesper Juhl
First we allocate memory for 'sysram' with vmalloc() and subsequently we allocate for 'info' with framebuffer_alloc(). If the second allocation fails we return -ENOMEM, but neglect to vfree() the memory we previously allocated for 'sysram', thus leaking it. Signed-off-by: Jesper Juhl j

[PATCH] gma500: Don't needlessly include version.h in mdfld_dsi_output.h

2012-04-12 Thread Jesper Juhl
drivers/gpu/drm/gma500/mdfld_dsi_output.h does not need to '#include ' - so don't. Signed-off-by: Jesper Juhl --- drivers/gpu/drm/gma500/mdfld_dsi_output.h |1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_output.h b/drivers/gpu/drm/gma500

[PATCH] gma500: Don't needlessly include version.h in mdfld_dsi_output.h

2012-04-11 Thread Jesper Juhl
drivers/gpu/drm/gma500/mdfld_dsi_output.h does not need to '#include linux/version.h' - so don't. Signed-off-by: Jesper Juhl j...@chaosbits.net --- drivers/gpu/drm/gma500/mdfld_dsi_output.h |1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_output.h b/drivers

[PATCH 02/26] radeon_cp: Remove unneeded tests for NULL before calling release_firmware()

2012-04-09 Thread Jesper Juhl
release_firmware() does its own tests for NULL pointers so there's no need to explicitly test before calling it. Signed-off-by: Jesper Juhl --- drivers/gpu/drm/radeon/radeon_cp.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/radeon

[PATCH 02/26] radeon_cp: Remove unneeded tests for NULL before calling release_firmware()

2012-04-09 Thread Jesper Juhl
release_firmware() does its own tests for NULL pointers so there's no need to explicitly test before calling it. Signed-off-by: Jesper Juhl j...@chaosbits.net --- drivers/gpu/drm/radeon/radeon_cp.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm

[PATCH] nouveau: kfree() gracefully handles NULL pointers, testing is redundant

2012-03-15 Thread Jesper Juhl
Remove redundant NULL checks before kfree() in drivers/gpu/drm/nouveau/nvc0_graph.c Signed-off-by: Jesper Juhl --- drivers/gpu/drm/nouveau/nvc0_graph.c |9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nvc0_graph.c b/drivers/gpu/drm/nouveau

[PATCH] nouveau: kfree() gracefully handles NULL pointers, testing is redundant

2012-03-14 Thread Jesper Juhl
Remove redundant NULL checks before kfree() in drivers/gpu/drm/nouveau/nvc0_graph.c Signed-off-by: Jesper Juhl j...@chaosbits.net --- drivers/gpu/drm/nouveau/nvc0_graph.c |9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nvc0_graph.c b

[PATCH][trivial] radeon: remove redundant ';' from radeon_vm_bo_update_pte()

2012-02-26 Thread Jesper Juhl
return statement needs just one semi-colon Signed-off-by: Jesper Juhl --- drivers/gpu/drm/radeon/radeon_gart.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index 010dad8..d5b1adc 100644

[PATCH][trivial] gma500: remove redundant ';' and redundant 'else' from drivers/gpu/drm/gma500/power.c

2012-02-26 Thread Jesper Juhl
Signed-off-by: Jesper Juhl --- drivers/gpu/drm/gma500/power.c |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/gma500/power.c b/drivers/gpu/drm/gma500/power.c index 9402569..6486f61 100644 --- a/drivers/gpu/drm/gma500/power.c +++ b/drivers/gpu/drm

[PATCH][trivial] gma500: remove redundant ';' and redundant 'else' from drivers/gpu/drm/gma500/power.c

2012-02-26 Thread Jesper Juhl
Signed-off-by: Jesper Juhl j...@chaosbits.net --- drivers/gpu/drm/gma500/power.c |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/gma500/power.c b/drivers/gpu/drm/gma500/power.c index 9402569..6486f61 100644 --- a/drivers/gpu/drm/gma500/power.c +++ b

[PATCH][trivial] radeon: remove redundant ';' from radeon_vm_bo_update_pte()

2012-02-26 Thread Jesper Juhl
return statement needs just one semi-colon Signed-off-by: Jesper Juhl j...@chaosbits.net --- drivers/gpu/drm/radeon/radeon_gart.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index 010dad8

[PATCH] [trivial] drm: Fix typo in vmwgfx_drv.c

2012-02-05 Thread Jesper Juhl
On Sun, 5 Feb 2012, Masanari Iida wrote: > Correct spelling "unsuported" to "unsupported" in > drivers/gpu/drm/vmwgfx/vmwgfx_drv.c > > Signed-off-by: Masanari Iida Reviewed-by: Jesper Juhl > --- > drivers/gpu/drm/vmwgfx/vmwgfx_drv.c |2 +-

Re: [PATCH] [trivial] drm: Fix typo in vmwgfx_drv.c

2012-02-05 Thread Jesper Juhl
On Sun, 5 Feb 2012, Masanari Iida wrote: Correct spelling unsuported to unsupported in drivers/gpu/drm/vmwgfx/vmwgfx_drv.c Signed-off-by: Masanari Iida standby2...@gmail.com Reviewed-by: Jesper Juhl j...@chaosbits.net --- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c |2 +- 1 files changed

[PATCH] intel, gma500, lvds: Fix use after free and mem leak in psb_intel_lvds_init()

2012-01-18 Thread Jesper Juhl
On Tue, 17 Jan 2012, Patrik Jakobsson wrote: > On Sat, Jan 14, 2012 at 10:15 PM, Jesper Juhl wrote: > > In psb_intel_lvds_init(), if we fail to allocate memory for > > 'psb_intel_connector' we free the memory we previously allocated for > > 'psb_intel_encoder', but w

Re: [PATCH] intel, gma500, lvds: Fix use after free and mem leak in psb_intel_lvds_init()

2012-01-17 Thread Jesper Juhl
On Tue, 17 Jan 2012, Patrik Jakobsson wrote: On Sat, Jan 14, 2012 at 10:15 PM, Jesper Juhl wrote: In psb_intel_lvds_init(), if we fail to allocate memory for 'psb_intel_connector' we free the memory we previously allocated for 'psb_intel_encoder', but we then proceed to use that free'd

[PATCH] intel, gma500, lvds: Fix use after free and mem leak in psb_intel_lvds_init()

2012-01-14 Thread Jesper Juhl
ned-off-by: Jesper Juhl --- drivers/gpu/drm/gma500/psb_intel_lvds.c |9 - 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/gma500/psb_intel_lvds.c b/drivers/gpu/drm/gma500/psb_intel_lvds.c index a25e4ca..0a43758 100644 --- a/drivers/gpu/drm/gma

[PATCH] intel, gma500, lvds: Fix use after free on psb_intel_lvds_init()

2012-01-14 Thread Jesper Juhl
On Sat, 14 Jan 2012, Jesper Juhl wrote: > In psb_intel_lvds_init(), if we fail to allocate memory for > 'psb_intel_connector' we free the memory we previously allocated for > 'psb_intel_encoder', but we then proceed to use that free'd pointer > when we do 'psb_intel_encoder->dev_p

[PATCH] gpu, drm, sis: Don't return uninitialized variable from sis_driver_load()

2012-01-14 Thread Jesper Juhl
In sis_driver_load(), the only use of 'ret' is as the return value from the function, unfortunately it is never initialized, so the function just returns garbage when it succeeds. To fix that, remove the variable and just return 0 directly on success. Signed-off-by: Jesper Juhl --- drivers/gpu

[PATCH] intel, gma500, lvds: Fix use after free on psb_intel_lvds_init()

2012-01-14 Thread Jesper Juhl
so it is not needed. Signed-off-by: Jesper Juhl --- drivers/gpu/drm/gma500/psb_intel_lvds.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) I considered adding a new label at the end and use a goto instead, but settled on this minimal solution. If consolidating all exits from the funct

[PATCH] intel, gma500, lvds: Fix use after free on psb_intel_lvds_init()

2012-01-14 Thread Jesper Juhl
it is not needed. Signed-off-by: Jesper Juhl j...@chaosbits.net --- drivers/gpu/drm/gma500/psb_intel_lvds.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) I considered adding a new label at the end and use a goto instead, but settled on this minimal solution. If consolidating all exits from

[PATCH] gpu, drm, sis: Don't return uninitialized variable from sis_driver_load()

2012-01-14 Thread Jesper Juhl
In sis_driver_load(), the only use of 'ret' is as the return value from the function, unfortunately it is never initialized, so the function just returns garbage when it succeeds. To fix that, remove the variable and just return 0 directly on success. Signed-off-by: Jesper Juhl j...@chaosbits.net

Re: [PATCH] intel, gma500, lvds: Fix use after free on psb_intel_lvds_init()

2012-01-14 Thread Jesper Juhl
On Sat, 14 Jan 2012, Jesper Juhl wrote: In psb_intel_lvds_init(), if we fail to allocate memory for 'psb_intel_connector' we free the memory we previously allocated for 'psb_intel_encoder', but we then proceed to use that free'd pointer when we do 'psb_intel_encoder-dev_priv = lvds_priv

[PATCH] intel, gma500, lvds: Fix use after free and mem leak in psb_intel_lvds_init()

2012-01-14 Thread Jesper Juhl
-by: Jesper Juhl j...@chaosbits.net --- drivers/gpu/drm/gma500/psb_intel_lvds.c |9 - 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/gma500/psb_intel_lvds.c b/drivers/gpu/drm/gma500/psb_intel_lvds.c index a25e4ca..0a43758 100644 --- a/drivers/gpu/drm

[PATCH] nouveau: Do not leak in nv20_graph_create

2011-07-03 Thread Jesper Juhl
On Sun, 3 Jul 2011, Jesper Juhl wrote: > On Sun, 3 Jul 2011, Paul Menzel wrote: > > > Dear Jesper, > > > > > > Am Sonntag, den 03.07.2011, 12:25 +0200 schrieb Jesper Juhl: > > > If we return due to an unknown chipset in > > > drivers/gpu/drm/nou

[PATCH] nouveau: Do not leak in nv20_graph_create

2011-07-03 Thread Jesper Juhl
On Sun, 3 Jul 2011, Paul Menzel wrote: > Dear Jesper, > > > Am Sonntag, den 03.07.2011, 12:25 +0200 schrieb Jesper Juhl: > > If we return due to an unknown chipset in > > drivers/gpu/drm/nouveau/nv20_graph.c:nv20_graph_create() we'll leak the > &g

[PATCH] nouveau: Do not leak in nv20_graph_create

2011-07-03 Thread Jesper Juhl
ich branch created the error which is impossible if the error messages are 100% identical. Signed-off-by: Jesper Juhl --- drivers/gpu/drm/nouveau/nv20_graph.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) Don't have the hardware, so compile tested only. diff --git a/drivers/gpu/d

[PATCH] nouveau: Don't leak in nva3_pm_clock_pre()

2011-07-03 Thread Jesper Juhl
If nva3_calc_pll() returns less than 0 in drivers/gpu/drm/nouveau/nva3_pm.c:nva3_pm_clock_pre() we'll return without freeing 'pll'. This patch should fix the leak. Signed-off-by: Jesper Juhl --- drivers/gpu/drm/nouveau/nva3_pm.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions

[PATCH] nouveau: Don't leak in nva3_pm_clock_pre()

2011-07-03 Thread Jesper Juhl
If nva3_calc_pll() returns less than 0 in drivers/gpu/drm/nouveau/nva3_pm.c:nva3_pm_clock_pre() we'll return without freeing 'pll'. This patch should fix the leak. Signed-off-by: Jesper Juhl j...@chaosbits.net --- drivers/gpu/drm/nouveau/nva3_pm.c |4 +++- 1 files changed, 3 insertions(+), 1

[PATCH] nouveau: Do not leak in nv20_graph_create

2011-07-03 Thread Jesper Juhl
created the error which is impossible if the error messages are 100% identical. Signed-off-by: Jesper Juhl j...@chaosbits.net --- drivers/gpu/drm/nouveau/nv20_graph.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) Don't have the hardware, so compile tested only. diff --git a/drivers

Re: [PATCH] nouveau: Do not leak in nv20_graph_create

2011-07-03 Thread Jesper Juhl
On Sun, 3 Jul 2011, Paul Menzel wrote: Dear Jesper, Am Sonntag, den 03.07.2011, 12:25 +0200 schrieb Jesper Juhl: If we return due to an unknown chipset in drivers/gpu/drm/nouveau/nv20_graph.c:nv20_graph_create() we'll leak the memory allocated to 'pgraph'. This patch should fix

Re: [PATCH] nouveau: Do not leak in nv20_graph_create

2011-07-03 Thread Jesper Juhl
On Sun, 3 Jul 2011, Jesper Juhl wrote: On Sun, 3 Jul 2011, Paul Menzel wrote: Dear Jesper, Am Sonntag, den 03.07.2011, 12:25 +0200 schrieb Jesper Juhl: If we return due to an unknown chipset in drivers/gpu/drm/nouveau/nv20_graph.c:nv20_graph_create() we'll leak the memory

[PATCH] i915: Don't leak in i915_gem_shmem_pread_slow()..

2011-06-11 Thread Jesper Juhl
It seems to me that we are leaking 'user_pages' in drivers/gpu/drm/i915/i915_gem.c::i915_gem_shmem_pread_slow() if read_cache_page_gfp() fails. Signed-off-by: Jesper Juhl --- i915_gem.c |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Untested patch - user be warned. diff --git

[PATCH] i915: Don't leak in i915_gem_shmem_pread_slow()..

2011-06-10 Thread Jesper Juhl
It seems to me that we are leaking 'user_pages' in drivers/gpu/drm/i915/i915_gem.c::i915_gem_shmem_pread_slow() if read_cache_page_gfp() fails. Signed-off-by: Jesper Juhl j...@chaosbits.net --- i915_gem.c |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Untested patch - user

[PATCH] radeon mkregtable: Add missing fclose() calls

2011-02-07 Thread Jesper Juhl
complaining about leaked memory and missing fclose() calls and it also seems to be the prefered style of the existing code to explicitly close the file. So, here's a patch to add the two missing fclose() calls. Signed-off-by: Jesper Juhl j...@chaosbits.net --- mkregtable.c |5 - 1 file

[PATCH] radeon mkregtable: Add missing fclose() calls

2011-02-05 Thread Jesper Juhl
complaining about leaked memory and missing fclose() calls and it also seems to be the prefered style of the existing code to explicitly close the file. So, here's a patch to add the two missing fclose() calls. Signed-off-by: Jesper Juhl --- mkregtable.c |5 - 1 file changed, 4 insertions

[PATCH 03/17][trivial] GPU DRM: Remove unnecessary casts of void ptr returning alloc function return values

2010-11-09 Thread Jesper Juhl
Hi, The [vk][cmz]alloc(_node) family of functions return void pointers which it's completely unnecessary/pointless to cast to other pointer types since that happens implicitly. This patch removes such casts from drivers/gpu/drm/ Signed-off-by: Jesper Juhl --- drm_sman.c |4 +--- 1 file

[PATCH 03/17][trivial] GPU DRM: Remove unnecessary casts of void ptr returning alloc function return values

2010-11-09 Thread Jesper Juhl
Hi, The [vk][cmz]alloc(_node) family of functions return void pointers which it's completely unnecessary/pointless to cast to other pointer types since that happens implicitly. This patch removes such casts from drivers/gpu/drm/ Signed-off-by: Jesper Juhl j...@chaosbits.net --- drm_sman.c