[PATCH 19/42] drivers/media/video: Adjust confusing if indentation

2010-08-05 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk In cx23885/cx23885-video.c, cx88/cx88-video.c, davinci/vpif_capture.c, and davinci/vpif_display.c, group the aligned code into a single if branch. In saa7134/saa7134-video.c, outdent the code following the if. The semantic match that finds this problem

[PATCH 42/42] drivers/media/video/bt8xx: Adjust confusing if indentation

2010-08-05 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk Indent the branch of an if. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // smpl @r disable braces4@ position p1,p2; statement S1,S2; @@ ( if (...) { ... } | if (...) s...@p1 s...@p2 ) @script:python@ p1 r.p1; p2

[PATCH 4/16] drivers/media/video/zoran: Use available error codes

2010-08-16 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk Error codes are stored in res, but the return value is always 0. Return res instead. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // smpl @r@ local idexpression x; constant C; @@ if (...) { ... x = -C ... when != x

[PATCH 6/16] drivers/media: Use available error codes

2010-08-16 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk In each case, error codes are stored in rc, but the return value is always 0. Return rc instead. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // smpl @r@ local idexpression x; constant C; @@ if (...) { ... x = -C

[PATCH 11/16] drivers/media/video: Use available error codes

2010-08-16 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk Error codes are stored in rc, but the return value is always 0. Return rc instead. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // smpl @r@ local idexpression x; constant C; @@ if (...) { ... x = -C ... when != x

[PATCH 1/3] drivers/media/video/em28xx: Remove potential NULL dereference

2010-08-26 Thread Julia Lawall
-fld; + T i; ... when != E when != i if (E == NULL) S + i = E-fld; // /smpl Signed-off-by: Julia Lawall ju...@diku.dk --- drivers/media/video/em28xx/em28xx-video.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers

[PATCH 6/7] drivers/media/dvb/siano: Remove double test

2010-08-28 Thread Julia Lawall
The same expression is tested twice and the result is the same each time. The sematic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // smpl @expression@ expression E; @@ ( * E || ... || E | * E ... E ) // /smpl Signed-off-by: Julia Lawall ju...@diku.dk

[PATCH 1/4] drivers/media/dvb/ttpci/av7110_av.c: Add missing error handling code

2010-10-02 Thread Julia Lawall
;} ... *if (...) {... when != S1 return -C2;} ... *if (...) {... S1 return -C3;} // /smpl Signed-off-by: Julia Lawall ju...@diku.dk --- This is only a suggestion. All of the other ways out of this function call wake_up(buf-queue);. But I don't understand the code well enough to know why

[PATCH 5/5] drivers/media/video/davinci/vpbe_display.c: eliminate a null pointer dereference

2011-10-28 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk In the original code, probe_out could be reached when res was null and then when the irq had not yet been requested. In those cases, the call to free_irq is not needed, so move probe_out down and introduce a new label for the case where calling free_irq is useful

Re: [PATCH] video/saa7164: Fix sparse warning: Using plain integer as NULL pointer

2011-01-25 Thread Julia Lawall
On Tue, 25 Jan 2011, Peter Huewe wrote: This patch fixes the warning Using plain integer as NULL pointer, generated by sparse, by replacing the offending 0s with NULL. I recall (a number of years ago) being told that for things like kmalloc, the proper test was !x, not x == NULL. julia

Re: [PATCH] video/saa7164: Fix sparse warning: Using plain integer as NULL pointer

2011-01-25 Thread Julia Lawall
On Tue, 25 Jan 2011, Peter Hüwe wrote: Am Dienstag 25 Januar 2011, 23:20:44 schrieb Julia Lawall: On Tue, 25 Jan 2011, Peter Huewe wrote: This patch fixes the warning Using plain integer as NULL pointer, generated by sparse, by replacing the offending 0s with NULL. I recall

[PATCH 2/2] drivers/media/rc/imon.c: Correct call to input_free_device

2011-05-14 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk ictx-touch is intialied in imon_init_intf1, to the result of calling the function that contains this code. Thus, in this code, input_free_device should be called on touch itself. A simplified version of the semantic match that finds this problem is: (http

[PATCH 1/5] drivers/media/video/cx231xx/cx231xx-cards.c: add missing kfree

2011-07-04 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk Clear the cx231xx_devused variable and free dev in the error handling code, as done in the error handling code nearby. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // smpl @r@ identifier x; @@ kfree(x) @@ identifier

[PATCH 2/5] drivers/media/video: add missing kfree

2011-07-04 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk Free the recently allocated qcam in each case. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // smpl @r@ identifier x; @@ kfree(x) @@ identifier r.x; expression E1!=0,E2,E3,E4; statement S; @@ ( if (+...x...+) S

[PATCH 2/6] drivers/media/dvb/dvb-usb/usb-urb.c: adjust array index

2011-07-28 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk Convert array index from the loop bound to the loop index. A simplified version of the semantic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression e1,e2,ar; @@ for(e1 = 0; e1 e2; e1++) { ... ar[ - e2 + e1

[PATCH 3/4] drivers/media/video/hexium_gemini.c: delete useless initialization

2011-08-04 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk Delete nontrivial initialization that is immediately overwritten by the result of an allocation function. The semantic match that makes this change is as follows: (http://coccinelle.lip6.fr/) // smpl @@ type T; identifier i; expression e; @@ ( T i = \(0\|NULL

[PATCH] drivers/media/video/zr364xx.c: add missing cleanup code

2011-08-12 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk It seems just as necessary to free cam-vdev and cam in this error case as in the next one. Signed-off-by: Julia Lawall ju...@diku.dk --- There is yet another block of error handling code below the call to zr364xx_board_init, but perhaps no cleanup code is needed

tvaudio.c: possible problem with V4L2_TUNER_MODE_MONO

2009-05-02 Thread Julia Lawall
The file drivers/media/video/tvaudio.c contains the following code: (starting at line 1257 in a recent linux-next) if (mode V4L2_TUNER_MODE_MONO) s1 |= TDA8425_S1_STEREO_MONO; if (mode V4L2_TUNER_MODE_STEREO) s1 |=

[PATCH 6/14] drivers/media/video: Move dereference after NULL test

2009-10-17 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk In quickcam_messenger.c, if the NULL test on uvd is needed, then the dereference should be after the NULL test. In vpif_display.c, std_info is initialized to the address of a structure field. This seems unlikely to be NULL. If it could somehow be NULL

[PATCH 1/8] drivers/media/video: introduce missing kfree

2009-11-21 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk Error handling code following a kzalloc should free the allocated data. Similarly for usb-alloc urb. The semantic match that finds the first problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // smpl @r exists@ local idexpression x; statement S

[PATCH 4/12] drivers/media/radio: Correct size given to memset

2009-12-09 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk Memset should be given the size of the structure, not the size of the pointer. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // smpl @@ type T; T *x; expression E; @@ memset(x, E, sizeof( + * x)) // /smpl Signed-off

[PATCH 5/12] drivers/media/video/uvc: Correct size given to memset

2009-12-09 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk Memset should be given the size of the structure, not the size of the pointer. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // smpl @@ type T; T *x; expression E; @@ memset(x, E, sizeof( + * x)) // /smpl Signed-off

[PATCH 3/9] drivers/media: Correct code taking the size of a pointer

2009-12-13 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk sizeof(print_buf) is just the size of the pointer. Change it to the size used in the allocation of print_buf earlier in the same function. A simplified version of the semantic patch that finds this problem is as follows: (http://coccinelle.lip6.fr/) // smpl

[PATCH] drivers/media/dvb: Move a dereference below a NULL test

2009-12-22 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk If the NULL test is necessary, then the dereference should be moved below the NULL test. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // smpl @@ type T; expression E; identifier i,fld; statement S; @@ - T i = E

[PATCH 3/20] drivers/media: Use kzalloc

2010-05-13 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk Use kzalloc rather than the combination of kmalloc and memset. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression x,size,flags; statement S; @@ -x = kmalloc(size,flags); +x = kzalloc(size,flags); if (x

[PATCH 4/4] drivers/media/video: Eliminate use after free

2010-05-15 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk The error value is saved in a new local variable err before freeing the containing structure. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // smpl @free@ expression E; position p; @@ kf...@p(E

[PATCH 6/37] drivers/media/video/gspca: Use kmemdup

2010-05-15 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk Use kmemdup when some other buffer is immediately copied into the allocated region. A simplified version of the semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression from,to,size,flag; statement S

[PATCH 8/37] drivers/media/video/zoran: Use kmemdup

2010-05-15 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk Use kmemdup when some other buffer is immediately copied into the allocated region. A simplified version of the semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression from,to,size,flag; statement S

[PATCH 16/37] drivers/media/video/uvc: Use kmemdup

2010-05-15 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk Use kmemdup when some other buffer is immediately copied into the allocated region. A simplified version of the semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression from,to,size,flag; statement S

[PATCH 18/37] drivers/media/video/tlg2300: Use kmemdup

2010-05-15 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk Use kmemdup when some other buffer is immediately copied into the allocated region. A simplified version of the semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression from,to,size,flag; statement S

[PATCH 9/27] drivers/media: Use memdup_user

2010-05-22 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk Use memdup_user when user data is immediately copied into the allocated region. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression from,to,size,flag; position p; identifier l1,l2; @@ - to = \(kmal...@p

[PATCH 5/17] drivers/media/video/pvrusb2: Add missing mutex_unlock

2010-05-26 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk Add a mutex_unlock missing on the error path. In the other functions in the same file the locks and unlocks of this mutex appear to be balanced, so it would seem that the same should hold in this case. The semantic match that finds this problem is as follows

[PATCH 8/11] drivers/media: Eliminate a NULL pointer dereference

2010-05-27 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk In each case, the print involves dereferencing a value that is NULL or is near NULL. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // smpl @r exists@ expression E,E1; identifier f; statement S1,S2

[PATCH 4/4] drivers/media/video/s5p-mfc/s5p_mfc.c: adjust double test

2012-01-12 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr Rewrite a duplicated test to test the correct value The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression E; @@ ( * E || ... || E | * E ... E ) // /smpl Signed-off-by: Julia Lawall julia.law

[PATCH 4/5] drivers/media/video/s5p-mfc/s5p_mfc.c: adjust double test

2012-01-12 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr Rewrite a duplicated test to test the correct value The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression E; @@ ( * E || ... || E | * E ... E ) // /smpl Signed-off-by: Julia Lawall julia.law

[PATCH v2 2/5] drivers/media/video/s5p-fimc/fimc-capture.c: adjust double test

2012-01-12 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr Rewrite a duplicated test to test the correct value The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression E; @@ ( * E || ... || E | * E ... E ) // /smpl Signed-off-by: Julia Lawall julia.law

[PATCH] drivers/media/video/s5p-tv/*_drv.c: use devm_ functions

2012-02-09 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr The various devm_ functions allocate memory that is released when a driver detaches. This patch uses these functions for data that is allocated in the probe function of a platform device and is only freed in the remove function. Signed-off-by: Julia

[PATCH] use devm_ functions

2012-02-09 Thread Julia Lawall
The semantic patch (http://coccinelle.lip6.fr/) used in generating this patch is as follows. Some manual cleanup was required. This improves on the previous version in that allocated values are allowed to be renamed before they are freed. virtual after_start virtual returned virtual arg virtual

Re: [PATCH] isdn: Return -EINTR in gigaset_start() if locking attempts fails.

2012-03-17 Thread Julia Lawall
On Sat, 17 Mar 2012, David Miller wrote: From: santosh prasad nayak santoshprasadna...@gmail.com Date: Sat, 17 Mar 2012 21:26:14 +0530 Caller is interpreting 0 in opposite way of normal sequence. Thats why I misunderstood it. The simple fact is that you didn't even look at the code at the

Re: [patch] [media] dt3155v4l: unlock on error path

2013-04-08 Thread Julia Lawall
On Tue, 9 Apr 2013, Dan Carpenter wrote: We should unlock here and do some cleanup before returning. We can't actually hit this return path with the current code, so this patch is a basically a cleanup and doesn't change how the code works. Why keep the return path then? If the code is

[PATCH] drivers/media/dvb/siano/smscoreapi.c: use list_for_each_entry

2012-07-15 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr Use list_for_each_entry and perform some other induced simplifications. The semantic match that finds the opportunity for this reorganization is as follows: (http://coccinelle.lip6.fr/) // smpl @@ struct list_head *pos; struct list_head *head; statement S

[PATCH 1/2] drivers/staging/media/easycap/easycap_main.c: add missing usb_free_urb

2012-07-24 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr Add missing usb_free_urb on failure path after usb_alloc_urb. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // smpl @km exists@ local idexpression e; expression e1,e2,e3; type T,T1

[PATCH 1/3] drivers/media/radio/radio-timb.c: use devm_ functions

2012-07-31 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr The various devm_ functions allocate memory that is released when a driver detaches. This patch uses these functions for data that is allocated in the probe function of a platform device and is only freed in the remove function. Signed-off-by: Julia

[PATCH 3/3] drivers/media/radio/radio-wl1273.c: use devm_ functions

2012-07-31 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr The various devm_ functions allocate memory that is released when a driver detaches. This patch uses these functions for data that is allocated in the probe function of a platform device and is only freed in the remove function. In two cases, the original

[PATCH 2/3] drivers/media/radio/radio-si4713.c: use devm_ functions

2012-07-31 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr The various devm_ functions allocate memory that is released when a driver detaches. This patch uses these functions for data that is allocated in the probe function of a platform device and is only freed in the remove function. Signed-off-by: Julia

[PATCH] drivers/media/video/mx2_emmaprp.c: use devm_kzalloc and devm_clk_get

2012-08-04 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr Using devm_kzalloc and devm_clk_get simplifies the code and ensures that the use of devm_request_irq is safe. When kzalloc and kfree were used, the interrupt could be triggered after the handler's data argument had been freed. The problem of a free after

Re: [PATCH] drivers/media/video/mx2_emmaprp.c: use devm_kzalloc and devm_clk_get

2012-08-06 Thread Julia . Lawall
Quoting Lars-Peter Clausen l...@metafoo.de: On 08/06/2012 04:26 PM, Dan Carpenter wrote: On Mon, Aug 06, 2012 at 05:23:23PM +0300, Dan Carpenter wrote: On Sat, Aug 04, 2012 at 08:23:27PM +0200, Julia Lawall wrote: @@ -922,12 +920,7 @@ static int emmaprp_probe(struct platform_device *pdev

Re: [PATCH] drivers/media/video/mx2_emmaprp.c: use devm_kzalloc and devm_clk_get

2012-08-06 Thread Julia . Lawall
Quoting Lars-Peter Clausen l...@metafoo.de: On 08/06/2012 04:26 PM, Dan Carpenter wrote: On Mon, Aug 06, 2012 at 05:23:23PM +0300, Dan Carpenter wrote: On Sat, Aug 04, 2012 at 08:23:27PM +0200, Julia Lawall wrote: @@ -922,12 +920,7 @@ static int emmaprp_probe(struct platform_device *pdev

Re: [PATCH] drivers/media/video/mx2_emmaprp.c: use devm_kzalloc and devm_clk_get

2012-08-10 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr Using devm_kzalloc and devm_clk_get simplifies the code and ensures that the use of devm_request_irq is safe. When kzalloc and kfree were used, the interrupt could be triggered after the handler's data argument had been freed. Add missing return code

Re: [PATCH] drivers/media/video/mx2_emmaprp.c: use devm_kzalloc and devm_clk_get

2012-08-13 Thread Julia Lawall
On Mon, 13 Aug 2012, Mauro Carvalho Chehab wrote: Em 10-08-2012 10:59, Julia Lawall escreveu: From: Julia Lawall julia.law...@lip6.fr Using devm_kzalloc and devm_clk_get simplifies the code and ensures that the use of devm_request_irq is safe. When kzalloc and kfree were used, the interrupt

Re: [PATCH] drivers/media/video/mx2_emmaprp.c: use devm_kzalloc and devm_clk_get

2012-08-13 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr Using devm_kzalloc simplifies the code and ensures that the use of devm_request_irq is safe. When kzalloc and kfree were used, the interrupt could be triggered after the handler's data argument had been freed. This also introduces some missing

Re: [PATCH] drivers/media/video/mx2_emmaprp.c: use devm_kzalloc and devm_clk_get

2012-08-14 Thread Julia Lawall
Well, I've massively applied hundreds of patches today, but not much on this driver. Maybe it is better for you to wait for a couple of days for these to be at -next, or use, instead, our tree as the basis for it: git://linuxtv.org/media_tree.git staging/for_v3.7 I cloned this, but it

Re: [PATCH] drivers/media/video/mx2_emmaprp.c: use devm_kzalloc and devm_clk_get

2012-08-14 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr Using devm_kzalloc simplifies the code and ensures that the use of devm_request_irq is safe. When kzalloc and kfree were used, the interrupt could be triggered after the handler's data argument had been freed. This also introduces some missing

[PATCH 3/5] drivers/media/video/{s2255drv.c,tm6000/tm6000-alsa.c,tm6000/tm6000-input.c}: Remove potential NULL dereferences

2012-08-14 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr If the NULL test is necessary, the initialization involving a dereference of the tested value should be moved after the NULL test. The sematic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // smpl @@ type T; expression E

[PATCH 3/5] drivers/media/video/gspca/cpia1.c: introduce missing initialization

2012-08-18 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr The result of one call to a function is tested, and then at the second call to the same function, the previous result, and not the current result, is tested again. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr

[PATCH 2/5] drivers/media/video/mt9m032.c: introduce missing initialization

2012-08-18 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr The result of one call to a function is tested, and then at the second call to the same function, the previous result, and not the current result, is tested again. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr

[PATCH 5/5] drivers/media/video/m5mols/m5mols_core.c: introduce missing initialization

2012-08-18 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr The result of one call to a function is tested, and then at the second call to the same function, the previous result, and not the current result, is tested again. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr

[PATCH] drivers/media/video/au0828/au0828-video.c: add missing video_device_release

2012-04-22 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr At the point of the call to video_register_device, both dev-vbi_dev and dev-vdev have been allocated, and so should be freed on failure. The error-handling code is moved to the end of the function, to avoid code duplication. Signed-off-by: Julia Lawall

question about bt8xx/bttv-audio-hook.c, tvaudio.c

2012-06-06 Thread Julia Lawall
The files drivers/media/video/bt8xx/bttv-audio-hook.c and drivers/media/video/tvaudio.c contain a number of occurrences of eg: mode |= V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2; and if (mode V4L2_TUNER_MODE_MONO) (both from tvaudio.c) V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2 is

Re: question about bt8xx/bttv-audio-hook.c, tvaudio.c

2012-06-10 Thread Julia Lawall
On Sat, 9 Jun 2012, Hans Verkuil wrote: On Wed June 6 2012 09:06:23 Julia Lawall wrote: The files drivers/media/video/bt8xx/bttv-audio-hook.c and drivers/media/video/tvaudio.c contain a number of occurrences of eg: mode |= V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2; and if (mode

Re: [PATCH 13/13] drivers/media/tuners/e4000.c: use macros for i2c_msg initialization

2012-12-18 Thread Julia Lawall
On Tue, 18 Dec 2012, Jean Delvare wrote: Hi Julia, On Thu, 11 Oct 2012 08:45:43 +0200 (CEST), Julia Lawall wrote: I found 6 cases where there are more than 2 messages in the array. I didn't check how many cases where there are two messages but there is something other than one read

Re: [PATCH RESEND 6/6] clk: s5p-g2d: Fix incorrect usage of IS_ERR_OR_NULL

2013-01-01 Thread Julia Lawall
On Wed, 2 Jan 2013, Tony Prisk wrote: On Wed, 2013-01-02 at 08:10 +0300, Dan Carpenter wrote: clk_get() returns NULL if CONFIG_HAVE_CLK is disabled. I told Tony about this but everyone has been gone with end of year holidays so it hasn't been addressed. Tony, please fix it so people don't

Re: [PATCH RESEND 6/6] clk: s5p-g2d: Fix incorrect usage of IS_ERR_OR_NULL

2013-01-02 Thread Julia Lawall
On Wed, 2 Jan 2013, Russell King - ARM Linux wrote: On Wed, Jan 02, 2013 at 08:10:36AM +0300, Dan Carpenter wrote: clk_get() returns NULL if CONFIG_HAVE_CLK is disabled. I told Tony about this but everyone has been gone with end of year holidays so it hasn't been addressed. Tony,

Re: [PATCH RESEND 6/6] clk: s5p-g2d: Fix incorrect usage of IS_ERR_OR_NULL

2013-01-03 Thread Julia Lawall
On Thu, 3 Jan 2013, Dan Carpenter wrote: On Wed, Jan 02, 2013 at 06:31:53PM +1300, Tony Prisk wrote: On Wed, 2013-01-02 at 08:10 +0300, Dan Carpenter wrote: clk_get() returns NULL if CONFIG_HAVE_CLK is disabled. I told Tony about this but everyone has been gone with end of year

[PATCH 1/2] drivers/media/platform/soc_camera/pxa_camera.c: reposition free_irq to avoid access to invalid data

2013-01-07 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr The data referenced by an interrupt handler should not be freed before the interrupt is ended. The handler is pxa_camera_irq. This handler may call pxa_dma_start_channels, which references the channels that are freed on the lines before the call

Re: [PATCH 1/2] drivers/media/platform/soc_camera/pxa_camera.c: reposition free_irq to avoid access to invalid data

2013-01-07 Thread Julia Lawall
On Mon, 7 Jan 2013, Guennadi Liakhovetski wrote: (adding Robert to CC) Hi Julia Thanks for the patch. On Mon, 7 Jan 2013, Julia Lawall wrote: From: Julia Lawall julia.law...@lip6.fr The data referenced by an interrupt handler should not be freed before the interrupt is ended

[PATCH] drivers/media/platform/soc_camera/pxa_camera.c: use devm_ functions

2013-01-07 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr This patch uses various devm_ functions for data that is allocated in the probe function of a platform driver and is only freed in the remove function. This also fixes a checkpatch warning, removing a space before a \n in a string. Signed-off-by: Julia

Re: [PATCH 1/2] drivers/media/platform/soc_camera/pxa_camera.c: reposition free_irq to avoid access to invalid data

2013-01-07 Thread Julia Lawall
On Mon, 7 Jan 2013, Robert Jarzmik wrote: Guennadi Liakhovetski g.liakhovet...@gmx.de writes: (adding Robert to CC) I don't think any data is freed by pxa_free_dma(), it only disables DMA on a certain channel. Theoretically there could be a different problem: pxa_free_dma()

[PATCH 7/9] drivers/media/video/davinci/vpbe.c: introduce missing kfree

2011-12-23 Thread Julia Lawall
Signed-off-by: Julia Lawall ju...@diku.dk --- drivers/media/video/davinci/vpbe.c |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/davinci/vpbe.c b/drivers/media/video/davinci/vpbe.c index d773d30..99658ba 100644 --- a/drivers/media/video/davinci

[PATCH 9/9] drivers/staging/media/as102/as102_usb_drv.c: shift position of allocation code

2011-12-23 Thread Julia Lawall
... ( return \(0\|+...x...+\|ptr\); | return@p2 ...; ) @script:python@ p1 r.p1; p2 r.p2; @@ print * file: %s kmalloc %s return %s % (p1[0].file,p1[0].line,p2[0].line) // /smpl Signed-off-by: Julia Lawall ju...@diku.dk --- drivers/staging/media/as102/as102_usb_drv.c | 12 ++-- 1 file changed

Re: [patch 1/7] drivers/media/video: move dereference after NULL test

2010-02-03 Thread Julia Lawall
On Wed, 3 Feb 2010, Mauro Carvalho Chehab wrote: Hi Julia, From: Julia Lawall ju...@diku.dk diff -puN drivers/media/video/davinci/vpif_display.c~drivers-media-video-move-dereference-after-null-test drivers/media/video/davinci/vpif_display.c --- a/drivers/media/video/davinci

[PATCH 7/11] drivers/media: Correct NULL test

2010-02-06 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk In each case, the NULL test has been performed already. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // smpl @r@ expression *x; expression e; identifier l; @@ if (x == NULL || ...) { ... when

[PATCH 1/5] drivers/media: drop redundant memset

2010-03-09 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk The region set by the call to memset is immediately overwritten by the subsequent call to memcpy. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression e1,e2,e3,e4; @@ - memset(e1,e2,e3); memcpy(e1,e4,e3

RE: [patch 2/5] drivers/media/video: move dereference after NULL test

2010-03-11 Thread Julia Lawall
To: mche...@infradead.org Cc: linux-media@vger.kernel.org; a...@linux-foundation.org; ju...@diku.dk Subject: [patch 2/5] drivers/media/video: move dereference after NULL test From: Julia Lawall ju...@diku.dk In quickcam_messenger.c, if the NULL test on uvd is needed, then the dereference should

RE: [patch 2/5] drivers/media/video: move dereference after NULL test

2010-03-12 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk In quickcam_messenger.c, if the NULL test on uvd is needed, then the dereference should be after the NULL test. In vpif_display.c, std_info is initialized to the address of a structure field. This seems unlikely to be NULL. Test std_info-stdid instead

[PATCH] drivers/media/video: avoid NULL dereference

2010-03-21 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk If ov is NULL, it will not be possible to take the lock in the first place, so move the test up earlier. The semantic match that finds the problem is as follows: (http://coccinelle.lip6.fr/) // smpl @r exists@ expression E, E1; identifier f; statement S1,S3

Re: [PATCH] drivers/media/video: avoid NULL dereference

2010-03-23 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk It seems impossible for ov to be NULL at this point. The semantic match that finds the problem is as follows: (http://coccinelle.lip6.fr/) // smpl @r exists@ expression E, E1; identifier f; statement S1,S3; iterator iter; @@ if ((E == NULL

Re: [PATCH] drivers/media/video: avoid NULL dereference

2010-03-23 Thread Julia Lawall
I think we can pretty safely assume that we never get here with ov==NULL. Oh well, I'll leave the test there for others to ponder. OK. I didn't read far enough in this email and sent another patch, in case it's useful. julia -- To unsubscribe from this list: send the line unsubscribe

[PATCH] drivers/media/video/gspca: Add kmalloc NULL tests

2009-07-12 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk Check that the result of kmalloc is not NULL before passing it to other functions. The semantic match that finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // smpl @@ expression *x; identifier f; constant char *C; @@ x = \(kmalloc

[PATCH] drivers/media/dvb: Use dst_type field instead of type_flags

2009-07-21 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk It seems from other code that it is the dst_type field rather than the type_flags field that contains values of the form DST_TYPE_IS... The type_flags field contains values of the form DST_TYPE_HAS... The semantic match that finds this problem is as follows

[PATCH 3/10] drivers/media/video/gspca: introduce missing kfree

2009-08-01 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk Error handling code following a kmalloc should free the allocated data. The semantic match that finds the problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // smpl @r exists@ local idexpression x; statement S; expression E; identifier f,f1,l

[PATCH 2/8] drivers/media/video/uvc: introduce missing kfree

2009-09-11 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk Error handling code following kmalloc should free the allocated data. The semantic match that finds the problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // smpl @r exists@ local idexpression x; statement S; expression E; identifier f,f1,l; position

[PATCH 3/8] drivers/media/video/hdpvr: introduce missing kfree

2009-09-11 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk Error handling code following a kzalloc should free the allocated data. The semantic match that finds the problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // smpl @r exists@ local idexpression x; statement S; expression E; identifier f,f1,l

Re: [PATCH 2/8] drivers/media/video/uvc: introduce missing kfree

2009-09-13 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk Move the kzalloc and associated test after the stream/query test, to avoid the need to free the allocated if the stream/query test fails. The semantic match that finds the problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // smpl @r exists@ local

Re: [PATCH 2/8] drivers/media/video/uvc: introduce missing kfree

2009-09-15 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk Move the kzalloc and associated test after the stream/query test, to avoid the need to free the allocated if the stream/query test fails. The semantic match that finds the problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // smpl @r exists@ local

[PATCH 2/6] drivers/media/platform/mx2_emmaprp.c: adjust inconsistent IS_ERR and PTR_ERR

2012-08-25 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr Change the call to IS_ERR to test the value that was just initialized and is returned using PTR_ERR. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression e,e1; @@ ( if (IS_ERR(e)) { ... PTR_ERR(e

question about drivers/media/dvb-frontends/rtl2830.c

2012-08-26 Thread Julia Lawall
The function rtl2830_init contains the code: buf[0] = tmp 6; buf[0] = (if_ctl 16) 0x3f; buf[1] = (if_ctl 8) 0xff; buf[2] = (if_ctl 0) 0xff; Is there any purpose to initializing buf[0] twice? julia -- To unsubscribe from this list: send the line

[PATCH] drivers/media/dvb-frontends/rtl2830.c: correct double assignment

2012-08-26 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr The double assignment is meant to be a bit-or to combine two values. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression i; @@ *i = ...; i = ...; // /smpl Signed-off

Re: question about drivers/media/dvb-frontends/rtl2830.c

2012-08-26 Thread Julia Lawall
On Sun, 26 Aug 2012, Antti Palosaari wrote: On 08/26/2012 02:20 PM, Andy Walls wrote: Julia Lawall julia.law...@lip6.fr wrote: The function rtl2830_init contains the code: buf[0] = tmp 6; buf[0] = (if_ctl 16) 0x3f; buf[1] = (if_ctl 8) 0xff; buf[2

[PATCH 0/11] introduce macros for i2c_msg initialization

2012-10-07 Thread Julia Lawall
This patch set introduces some macros for describing how an i2c_msg is being initialized. There are three macros: I2C_MSG_READ, for a read message, I2C_MSG_WRITE, for a write message, and I2C_MSG_OP, for some other kind of message, which is expected to be very rarely used. Some i2c_msg

[PATCH 6/13] drivers/media/tuners/tda18271-common.c: use macros for i2c_msg initialization

2012-10-07 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr Introduce use of I2c_MSG_READ/WRITE/OP, for readability. A simplified version of the semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression a,b,c; identifier x; @@ struct i2c_msg x = - {.addr = a, .buf = b

[PATCH 7/13] drivers/media/tuners/tua9001.c: use macros for i2c_msg initialization

2012-10-07 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr Introduce use of I2c_MSG_READ/WRITE/OP, for readability. A simplified version of the semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression a,b,c; identifier x; @@ struct i2c_msg x = - {.addr = a, .buf = b

[PATCH 10/13] drivers/media/tuners/tda8290.c: use macros for i2c_msg initialization

2012-10-07 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr Introduce use of I2c_MSG_READ/WRITE/OP, for readability. A length expressed as an explicit constant is also re-expressed as the size of the bufferin each case. A simplified version of the semantic patch that makes this change is as follows: (http

[PATCH 9/13] drivers/media/tuners/fc0011.c: use macros for i2c_msg initialization

2012-10-07 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr Introduce use of I2c_MSG_READ/WRITE/OP, for readability. A length expressed as an explicit constant is also re-expressed as the size of the buffer in each case. A simplified version of the semantic patch that makes this change is as follows: (http

[PATCH 11/13] drivers/media/tuners/tda18218.c: use macros for i2c_msg initialization

2012-10-07 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr Introduce use of I2c_MSG_READ/WRITE/OP, for readability. A simplified version of the semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // smpl @@ expression a,b,c; identifier x; @@ struct i2c_msg x = - {.addr = a, .buf = b

[PATCH 8/13] drivers/media/tuners/fc2580.c: use macros for i2c_msg initialization

2012-10-07 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr Introduce use of I2c_MSG_READ/WRITE/OP, for readability. A length expressed as an explicit constant is also re-expressed as the size of the buffer in each case. A simplified version of the semantic patch that makes this change is as follows: (http

[PATCH 12/13] drivers/media/tuners/max2165.c: use macros for i2c_msg initialization

2012-10-07 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr Introduce use of I2c_MSG_READ/WRITE/OP, for readability. A length expressed as an explicit constant is also re-expressed as the size of the buffer, when this is possible. The second case is simplified to use simple variables rather than arrays

[PATCH 5/13] drivers/media/tuners: use macros for i2c_msg initialization

2012-10-07 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr Introduce use of I2c_MSG_READ/WRITE/OP, for readability. A length expressed as an explicit constant is also re-expressed as the size of the buffer, when this is possible. A simplified version of the semantic patch that makes this change is as follows

[PATCH 3/13] drivers/media/tuners/qt1010.c: use macros for i2c_msg initialization

2012-10-07 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr Introduce use of I2c_MSG_READ/WRITE/OP, for readability. A length expressed as an explicit constant is also re-expressed as the size of the buffer, when this is possible. A simplified version of the semantic patch that makes this change is as follows

[PATCH 4/13] drivers/media/tuners/tda18212.c: use macros for i2c_msg initialization

2012-10-07 Thread Julia Lawall
From: Julia Lawall julia.law...@lip6.fr Introduce use of I2c_MSG_READ/WRITE/OP, for readability. In the second initialization, a length expressed as an explicit constant is also re-expressed as the size of the buffer (reg). A simplified version of the semantic patch that makes this change

  1   2   3   4   >