Quentin LAMBERT

Author's posts

[S390] drivers/s390: Use an IS_ERR test rather than a NULL test

Author: Julien Brunel <brunel@diku.dk> In case of error, functions dasd_kmalloc_request and idal_buffer_alloc return an ERR pointer, but never return the NULL pointer. So after a call to one of these functions, a NULL test should be replaced by an IS_ERR test. A simplified version of the semantic patch that makes this change is as follows: …

Continue reading

V4L/DVB (8729): Use DIV_ROUND_UP

Author: Julia Lawall <julia@diku.dk> The kernel.h macro DIV_ROUND_UP performs the computation (((n) + (d) – 1) / (d)) but is perhaps more readable. An extract of the semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @haskernel@ @@ @depends on haskernel@ expression n,d; @@ ( – (n + d – 1) / d …

Continue reading

net/rxrpc: Use an IS_ERR test rather than a NULL test

Author: Julien Brunel <brunel@diku.dk> In case of error, the function rxrpc_get_transport returns an ERR pointer, but never returns a NULL pointer. So after a call to this function, a NULL test should be replaced by an IS_ERR test. A simplified version of the semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @correct_null_test@ …

Continue reading

IB/mad: Test ib_create_send_mad() return with IS_ERR(), not == NULL

Author: Julien Brunel <brunel@diku.dk> In case of error, the function ib_create_send_mad() returns an ERR pointer, but never returns a NULL pointer. So testing the return value for error should be done with IS_ERR, not by comparing with NULL. A simplified version of the semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @correct_null_test@ …

Continue reading

au1000_eth: use ‘unsigned long’ for irqflags

Author: Vegard Nossum <vegard.nossum@gmail.com> The patch was generated using the Coccinelle semantic patch framework. Cc: Julia Lawall Cc: Alexey Dobriyan Cc: Jeff Garzik Signed-off-by: Vegard Nossum Signed-off-by: Jeff Garzik — drivers/net/au1000_eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)   diff –git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c index cb8be49..5ee1b05 100644 — a/drivers/net/au1000_eth.c +++ b/drivers/net/au1000_eth.c @@ -807,7 …

Continue reading

drivers/video/fsl-diu-fb.c: add missing of_node_put

Author: Julia Lawall <julia@diku.dk> of_node_put is needed before discarding a value received from of_find_node_by_type, eg in error handling code. The semantic patch that makes the change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @@ struct device_node *n; struct device_node *n1; struct device_node *n2; statement S; identifier f1,f2; expression E1,E2; constant C; @@ n = of_find_node_by_type(…) … if …

Continue reading

IB/ipath: Use unsigned long for irq flags

Author: Vegard Nossum <vegard.nossum@gmail.com> A few functions in the ipath driver incorrectly use unsigned int to hold irq flags for spin_lock_irqsave(). This patch was generated using the Coccinelle framework with the following semantic patch: The semantic patch I used was this: @@ expression lock; identifier flags; expression subclass; @@ – unsigned int flags; + unsigned …

Continue reading

drivers/video: release mutex in error handling code

Author: Julia Lawall <julia@diku.dk> The mutex is released on a successful return, so it would seem that it should be released on an error return as well. The semantic patch finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @@ expression l; @@ mutex_lock(l); … when != mutex_unlock(l) when any when strict ( if (…) { …

Continue reading

PS3: gelic: use unsigned long for irqflags

Author: Vegard Nossum <vegard.nossum@gmail.com> The semantic patch I used was this: @@ expression lock; identifier flags; expression subclass; @@ – unsigned int flags; + unsigned long flags; … This patch was generated using the Coccinelle framework. Cc: Masakazu Mokuno Cc: Julia Lawall Cc: Alexey Dobriyan Signed-off-by: Vegard Nossum Signed-off-by: John W. Linville — drivers/net/ps3_gelic_wireless.c | …

Continue reading

[CPUFREQ] drivers/cpufreq/cpufreq.c: Adjust error handling code involving cpufreq_cpu_put

Author: Julia Lawall <julia@diku.dk> After calling cpufreq_cpu_get, error handling code should call cpufreq_cpu_put. The semantic match that finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r@ expression x,E; statement S; position p1,p2,p3; @@ ( if ((x = cpufreq_cpu_get@p1(…)) == NULL || …) S | x = cpufreq_cpu_get@p1(…) … when != x if (x == NULL …

Continue reading