On Tue, 17 Dec 2024, Alexander Gordeev wrote:
> On Tue, Dec 10, 2024 at 10:02:33PM +, Easwar Hariharan wrote:
>
> Hi Easwar,
>
> > This script finds and suggests conversions of timeout patterns that
> > result in seconds-denominated timeouts to use the new secs_to_jiffies()
> > API in inclu
Sent from my iPhone
> On 16 Nov 2024, at 05:40, Dan Carpenter wrote:
>
> On Sat, Nov 16, 2024 at 11:06:55AM +0100, Christophe Leroy wrote:
>>> diff --git a/arch/powerpc/platforms/pseries/papr_scm.c
>>> b/arch/powerpc/platforms/pseries/papr_scm.c
>>> index
>>> 9e297f88adc5d97d4dc7b267b0bfebd
Since SLOB was removed and since
commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from
kmem_cache_destroy()"),
it is not necessary to use call_rcu when the callback only performs
kmem_cache_free. Use kfree_rcu() directly.
The changes were made using Coccinelle.
Signed-off
Since SLOB was removed and since
commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from
kmem_cache_destroy()"),
it is not necessary to use call_rcu when the callback only performs
kmem_cache_free. Use kfree_rcu() directly.
The changes were done using the following Coccinelle semantic patc
Hello,
I have rerun the semantic patch that removes call_rcu calls in cases where
the callback function just does some pointer arithmetic and calls
kmem_cache_free. Let me know if this looks ok, and if so, I can make a
more formal patch submission.
This is against:
commit 75b607fab38d149f232f01
Reorganize kerneldoc parameter names to match the parameter
order in the function header.
The misordered cases were identified using the following
Coccinelle semantic patch:
//
@initialize:ocaml@
@@
let parse_doc l =
let pieces = List.map String.trim (String.split_on_char '*' l) in
let l =
Reorganize kerneldoc parameter names to match the parameter
order in the function header.
Problems identified using Coccinelle.
Signed-off-by: Julia Lawall
---
arch/powerpc/platforms/ps3/interrupt.c |2 +-
arch/powerpc/platforms/ps3/repository.c |2 +-
2 files changed, 2 insertions
sition r.p;
@@
- call_rcu(&e->f,cb@p)
+ kfree_rcu(e,f)
@r1a depends on !s@
type T;
identifier x,r.cb;
@@
- cb(...) {
(
- kmem_cache_free(...);
|
- T x = ...;
- kmem_cache_free(...,x);
|
- T x;
- x = ...;
- kmem_cache_free(...,x);
)
- }
//
Signed-off-by: Julia Lawall
Reviewed-by: Pa
sition r.p;
@@
- call_rcu(&e->f,cb@p)
+ kfree_rcu(e,f)
@r1a depends on !s@
type T;
identifier x,r.cb;
@@
- cb(...) {
(
- kmem_cache_free(...);
|
- T x = ...;
- kmem_cache_free(...,x);
|
- T x;
- x = ...;
- kmem_cache_free(...,x);
)
- }
//
Signed-off-by: Julia Lawall
Reviewed-by: Pa
On Tue, 16 Apr 2024, Christophe Leroy wrote:
>
>
> Le 16/04/2024 à 14:14, Markus Elfring a écrit :
> >> This is explicit in Kernel documentation:
> >>
> >> /**
> >>* kfree - free previously allocated memory
> >>* @object: pointer returned by kmalloc() or kmem_cache_alloc()
> >>*
> >>
for_each_node_with_property performs an of_node_get on each
iteration, so a break out of the loop requires an
of_node_put.
This was done using the Coccinelle semantic patch
iterators/for_each_child.cocci
Signed-off-by: Julia Lawall
---
arch/powerpc/kexec/file_load_64.c |8 ++--
1 file
for_each_node_by_name performs an of_node_get on each
iteration, so a break out of the loop requires an
of_node_put.
This was done using the Coccinelle semantic patch
iterators/for_each_child.cocci
Signed-off-by: Julia Lawall
---
arch/powerpc/platforms/powermac/low_i2c.c |4 +++-
arch
Add of_node_put on a break out of an of_node loop.
---
arch/powerpc/kexec/file_load_64.c|8 ++--
arch/powerpc/platforms/powermac/low_i2c.c|4 +++-
arch/powerpc/platforms/powermac/smp.c|4 +++-
drivers/bus/arm-cci.c
> >> @minus_one@
> >> expression FULL;
> >> @@
> >>
> >> - (get_random_int() & ((FULL) - 1)
> >> + prandom_u32_max(FULL)
> >
> >Ahh, well, okay, this is the example I mentioned above. Only works if
> >FULL is saturated. Any clever way to get coccinelle to prove that? Can
> >it look at the value of
On Mon, 25 Jul 2022, Michael Ellerman wrote:
> wangjianli writes:
> > Signed-off-by: wangjianli
> > ---
> > arch/powerpc/kvm/book3s_64_mmu_hv.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c
> > b/arch/powerpc/kvm/book3s_64
Spelling mistake (triple letters) in comment.
Detected with the help of Coccinelle.
Signed-off-by: Julia Lawall
---
include/misc/cxl.h |2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/misc/cxl.h b/include/misc/cxl.h
index 0410412de16b..d8044299d654 100644
--- a
On Thu, 5 May 2022, Joel Stanley wrote:
> On Sat, 30 Apr 2022 at 18:58, Julia Lawall wrote:
> >
> > Various spelling mistakes in comments.
> > Detected with the help of Coccinelle.
> >
> > Signed-off-by: Julia Lawall
>
> I read the patch and it appea
Various spelling mistakes in comments.
Detected with the help of Coccinelle.
Signed-off-by: Julia Lawall
---
arch/powerpc/boot/cuboot-hotfoot.c |2 +-
arch/powerpc/crypto/aes-spe-glue.c |2 +-
arch/powerpc/kernel/cputable.c |2
From: kernel test robot
for_each_node_by_type should have of_node_put() before return.
Generated by: scripts/coccinelle/iterators/for_each_child.cocci
CC: Sumera Priyadarsini
Reported-by: kernel test robot
Signed-off-by: kernel test robot
---
The code seems to have been this way since the b
= e
- snd_soc_dai_set_drvdata(y,x);
@@
expression x,y,e;
@@
x = snd_soc_dai_get_drvdata(y)
... when != x = e
- snd_soc_dai_set_drvdata(y,x);
//
Signed-off-by: Julia Lawall
---
sound/soc/fsl/fsl_micfil.c |2 --
sound/soc/fsl/fsl_sai.c|2 --
sound/soc/fsl/fsl_xcv
The file Documentation/powerpc/ultravisor.rst contains:
Only valid value(s) in ``flags`` are:
* H_PAGE_IN_SHARED which indicates that the page is to be shared
with the Ultravisor.
* H_PAGE_IN_NONSHARED indicates that the UV is not anymore
interested in the
On Fri, 8 May 2020, Jeremy Kerr wrote:
> Hi Julia,
>
> > Other uses of &gang->aff_list_head, eg in spufs_assert_affinity, indicate
> > that the list elements have type spu_context, not spu as used here. Change
> > the type of tmp accordingly.
>
> Looks good to me; we could even use ctx there,
("[CELL] cell: add placement computation for scheduling of
affinity contexts")
Signed-off-by: Julia Lawall
---
arch/powerpc/platforms/cell/spufs/sched.c |3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c
b/arch/powerpc/pla
On Fri, 3 Jan 2020, Dan Carpenter wrote:
> On Sun, Dec 29, 2019 at 04:42:54PM +0100, Julia Lawall wrote:
> > Mmgrab was introduced in commit f1f1007644ff ("mm: add new mmgrab()
> > helper") and most of the kernel was updated to use it. Update a few
> > remaining
Use resource_size rather than a verbose computation on
the end and start fields.
The semantic patch that makes these changes is as follows:
(http://coccinelle.lip6.fr/)
@@ struct resource ptr; @@
- (ptr.end - ptr.start + 1)
+ resource_size(&ptr)
Signed-off-by: Julia Lawall
---
arch/pow
Use resource_size rather than a verbose computation on
the end and start fields.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
@@ struct resource ptr; @@
- (ptr.end - ptr.start + 1)
+ resource_size(&ptr)
Signed-off-by: Julia Lawall
---
arch/pow
Use resource_size rather than a verbose computation on
the end and start fields.
The semantic patch that makes these changes is as follows:
(http://coccinelle.lip6.fr/)
@@
struct resource ptr;
@@
- ((ptr.end) - (ptr.start) + 1)
+ resource_size(&ptr)
@@
struct resource *ptr;
@@
- ((ptr->end) -
The mpic_ipi_chip and mpic_irq_ht_chip structures are only copied
into other structures, so make them const.
The opportunity for this change was found using Coccinelle.
Signed-off-by: Julia Lawall
---
arch/powerpc/sysdev/mpic.c |4 ++--
1 file changed, 2 insertions(+), 2 deletions
Make const static structures that are just copied into other structures.
The semantic patch that detects the opportunity for this change is as
follows: (http://coccinelle.lip6.fr/)
@r disable optional_qualifier@
identifier i,j;
position p;
@@
static struct i j@p = { ... };
@upd@
position p1;
id
ount);
+ mmgrab(e);
Signed-off-by: Julia Lawall
---
drivers/misc/cxl/context.c |2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/misc/cxl/context.c b/drivers/misc/cxl/context.c
index aed9c445d1e2..fb2eff69e449 100644
--- a/drivers/misc/cxl/context.c
+++ b/drivers/m
Mmgrab was introduced in commit f1f1007644ff ("mm: add new mmgrab()
helper") and most of the kernel was updated to use it. Update a few
remaining files.
---
arch/openrisc/kernel/smp.c |2 +-
drivers/misc/cxl/context.c |2 +-
drivers/vfio/pci/vfio_pci_nvlink2.c |2 +-
On Thu, 11 Jul 2019, wen.yan...@zte.com.cn wrote:
> > > we developed a coccinelle script to detect such problems.
> >
> > Would you find the implementation of the function “dt_init_idle_driver”
> > suspicious according to discussed source code search patterns?
> > https://git.kernel.org/pub/scm/
any
if (<+...of_device_is_available(e)...+>) {
... when != of_node_put(e)
(
return e;
|
+ of_node_put(e);
return ...;
)
}
//
Fixes: c026c98739c7e ("powerpc/83xx: Do not configure or probe disabled FSL DR
USB controllers")
Signed-off-by: Julia Lawall
---
arch/powerpc/plat
Failure of of_device_is_available implies that the device node
should be put, if it is not used otherwise.
---
arch/arm/mach-omap2/display.c|4 +++-
arch/powerpc/platforms/83xx/usb.c|4 +++-
drivers/bus/arm-cci.c
On Mon, 18 Feb 2019, YueHaibing wrote:
> Remove .owner field if calls are used which set it automatically
> Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci
>
> Signed-off-by: YueHaibing
> ---
> arch/powerpc/platforms/pseries/papr_scm.c | 2 +-
> 1 file changed, 1 insertion(+)
On Thu, 6 Dec 2018, Christophe LEROY wrote:
>
>
> Le 05/12/2018 à 04:26, Michael Ellerman a écrit :
> > Hi Dan,
> >
> > Thanks for the patch.
> >
> > Dan Carpenter writes:
> > > The ipic_info[] array only has 95 elements so I have made the bounds
> > > check smaller to prevent a read overflow.
On Wed, 5 Dec 2018, Michael Ellerman wrote:
> Julia Lawall writes:
> > On Wed, 5 Dec 2018, Michael Ellerman wrote:
> >
> >> Hi Dan,
> >>
> >> Thanks for the patch.
> >>
> >> Dan Carpenter writes:
> >> > The ipic_info[] a
On Wed, 5 Dec 2018, Michael Ellerman wrote:
> Hi Dan,
>
> Thanks for the patch.
>
> Dan Carpenter writes:
> > The ipic_info[] array only has 95 elements so I have made the bounds
> > check smaller to prevent a read overflow. It was Smatch that found
> > this issue:
> >
> > arch/powerpc/sy
> I wrote something like this as below but it failed to compile, Julia any
> suggestions on how to express this?
>
> @pte_alloc_func_proto depends on patch exists@
> type T1, T2, T3, T4;
> identifier fn =~
> "^(__pte_alloc|pte_alloc_one|pte_alloc|__pte_alloc_kernel|pte_alloc_one_kernel)$";
> @@
>
>
This looks wrong. After a list iterator, the index variable points to a
dummy structure.
julia
url:
https://github.com/0day-ci/linux/commits/Baoquan-He/resource-Use-list_head-to-link-sibling-resource/20180612-113600
:: branch date: 7 hours ago
:: commit date: 7 hours ago
>> kernel/r
On Mon, 4 Jun 2018, Dan Carpenter wrote:
> On Mon, Jun 04, 2018 at 10:25:14PM +0900, Julia Lawall wrote:
> >
> >
> > On Mon, 4 Jun 2018, Dan Carpenter wrote:
> >
> > > There is a copy and paste bug so we accidentally use the RX_ shift when
> &
On Mon, 4 Jun 2018, Dan Carpenter wrote:
> There is a copy and paste bug so we accidentally use the RX_ shift when
> we're in TX_ mode.
>
> Fixes: bb8b2062aff3 ("fsl/qe: setup clock source for TDM mode")
> Signed-off-by: Dan Carpenter
> ---
> Static analysis work. Not tested. This affects th
;
@@
for_each_child_of_node(root, child) {
... when != of_node_put(child)
when != e = child
+ of_node_put(child);
? break;
...
}
... when != child
//
Signed-off-by: Julia Lawall
---
drivers/pci/hotplug/pnv_php.c |8 ++--
1 file changed, 6 insertions(+), 2 deletions
The device node iterators perform an of_node_get on each iteration, so a
jump out of the loop requires an of_node_put.
---
drivers/gpu/drm/rockchip/rockchip_lvds.c |4 +++-
drivers/pci/hotplug/pnv_php.c |8 ++--
drivers/phy/hisilicon/phy-hisi-inno-usb2.c |9 +++
On Tue, 14 Nov 2017, Colin King wrote:
> From: Colin Ian King
>
> Trivial fix to spelling mistake in pr_err error message text
>
> Signed-off-by: Colin Ian King
> ---
> drivers/crypto/nx/nx-842-powernv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/crypto/n
On Wed, 18 Oct 2017, David Laight wrote:
> From: SF Markus Elfring
> > Unpleasant consequences are possible in both cases.
> > >> How much do you care to reduce the failure probability further?
> > >
> > > Zero.
> >
> > I am interested to improve the software situation a bit more here.
>
>
On Wed, 18 Oct 2017, alexander.stef...@infineon.com wrote:
> > On Wed, 2017-10-18 at 11:00 +0200, SF Markus Elfring wrote:
> > > > The printk removals do change the objects.
> > > >
> > > > The value of that type of change is only for resource limited systems.
> > >
> > > I imagine that such sma
On Tue, 17 Oct 2017, Mimi Zohar wrote:
> On Tue, 2017-10-17 at 14:58 +0200, Julia Lawall wrote:
> >
> > On Tue, 17 Oct 2017, Mimi Zohar wrote:
> >
> > > On Tue, 2017-10-17 at 11:50 +, alexander.stef...@infineon.com
> > > wrote:
> > > >
On Tue, 17 Oct 2017, Mimi Zohar wrote:
> On Tue, 2017-10-17 at 11:50 +, alexander.stef...@infineon.com
> wrote:
> > > > Replace the specification of data structures by pointer dereferences
> > > > as the parameter for the operator "sizeof" to make the corresponding
> > > > size
> > > > deter
On Tue, 17 Oct 2017, Dan Carpenter wrote:
> On Tue, Oct 17, 2017 at 10:56:42AM +0200, Julia Lawall wrote:
> >
> >
> > On Tue, 17 Oct 2017, Dan Carpenter wrote:
> >
> > > On Mon, Oct 16, 2017 at 09:35:12PM +0300, Jarkko Sakkinen wrote:
> > > >
&g
On Tue, 17 Oct 2017, Dan Carpenter wrote:
> On Mon, Oct 16, 2017 at 09:35:12PM +0300, Jarkko Sakkinen wrote:
> >
> > A minor complaint: all commits are missing "Fixes:" tag.
> >
>
> Fixes is only for bug fixes. These don't fix any bugs.
0-day seems to put Fixes for everything. Should they be
On Fri, 13 Oct 2017, Bhumika Goyal wrote:
> These structures are passed to the eeh_ops_register function during the
> initialization phase. There they get stored in a structure variable
> which only makes function calls through function pointers. There is no
> other usage of these eeh_ops struct
On Thu, 5 Oct 2017, Michal Suchánek wrote:
> Hello,
>
> On Thu, 5 Oct 2017 21:36:26 +0200
> SF Markus Elfring wrote:
>
> > From: Markus Elfring
> > Date: Thu, 5 Oct 2017 21:04:30 +0200
> >
> > Omit extra messages for a memory allocation failure in these
> > functions.
>
> this is bogus. All th
On Wed, 20 Sep 2017, Michael Ellerman wrote:
> Bhumika Goyal writes:
>
> > Make ehv_pic_irq_chip, mpic_ipi_chip and mpic_tm_chip const as they are
> > used only as a copy operation. This usage is during init, so make them
> > __initconst too.
> > Make mpic_ipi_chip __initdata as it is only modi
Hello,
At the suggestion of Christoph Hellwig, I am working on inlining the
functions stored in the err_handler field of a pci_driver structure into
the pci_driver structure itself. A number of functions in the file
arch/powerpc/kernel/eeh_driver.c have code like:
if (!driver->err_handle
On Sun, 13 Aug 2017, Joe Perches wrote:
> On Sun, 2017-08-13 at 15:24 +0200, Julia Lawall wrote:
> > Normally the values in the resource field and the argument to ARRAY_SIZE
> > in the num_resources are the same. In this case, the value in the reousrce
> > field is the s
field
with the argument to the local call to ARRAY_SIZE.
Signed-off-by: Julia Lawall
---
arch/powerpc/platforms/chrp/pegasos_eth.c |2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/chrp/pegasos_eth.c
b/arch/powerpc/platforms/chrp/pegasos_eth.c
index
These uart_ops structures are only stored in the ops field of a
uart_port structure and this fields is const, so the uart_ops
structures can also be const.
Done with the help of Coccinelle.
Signed-off-by: Julia Lawall
---
drivers/tty/serial/ucc_uart.c |2 +-
1 file changed, 1 insertion
These uart_ops structures are only stored in the ops field of a
uart_port structure and this fields is const, so the uart_ops
structures can also be const.
Done with the help of Coccinelle.
---
drivers/tty/serial/21285.c |2 +-
drivers/tty/serial/apbuart.c|
disable optional_qualifier@
identifier r.i;
@@
static
+const
struct wf_sensor_ops i = { ... };
//
Signed-off-by: Julia Lawall
---
drivers/macintosh/windfarm_lm75_sensor.c|2 +-
drivers/macintosh/windfarm_lm87_sensor.c|2 +-
drivers/macintosh/windfarm_max6690_sensor.c |2 +-
drivers/m
qe_ep0_desc is only passed as the second argument to qe_ep_init, which is
const, so qe_ep0_desc can be const too.
Done with the help of Coccinelle.
Signed-off-by: Julia Lawall
---
I got a lot of warnings when compiling this file, but none seemed to be
related to the change.
drivers/usb
On Tue, 30 May 2017, Takashi Iwai wrote:
> On Sat, 27 May 2017 16:46:15 +0200,
> Bhumika Goyal wrote:
> >
> > Declare snd_kcontrol_new structures as const as they are only passed an
> > argument to the function snd_ctl_new1. This argument is of type const,
> > so snd_kcontrol_new structures havi
_ATTR_RW;
identifier rw.x,rw.x_show,rw.x_store;
@@
- DEVICE_ATTR(x, \(0644\|S_IRUGO|S_IWUSR\), x_show, x_store);
+ DEVICE_ATTR_RW(x);
//
Signed-off-by: Julia Lawall
---
arch/powerpc/kernel/iommu.c |3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/iommu
Use DEVICE_ATTR_RO etc. for read only attributes etc. This simplifies the
source code, improves readbility, and reduces the chance of
inconsistencies.
The complete semantic patch is as follows:
(http://coccinelle.lip6.fr/)
//
@ro@
declarer name DEVICE_ATTR;
identifier x,x_show;
@@
DEVICE_ATTR
844371155 sound/soc/fsl/imx-wm8962.o
4229 200 844371155 sound/soc/fsl/imx-wm8962.o
Signed-off-by: Julia Lawall
---
sound/soc/fsl/fsl-asoc-card.c |2 +-
sound/soc/fsl/imx-wm8962.c|2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff -u -p a/s
fier r.i;
expression e1, e2;
position p;
@@
snd_pcm_set_ops(e1, e2, &i@p)
@bad@
position p != {r.p,ok1.p,ok2.p};
identifier r.i;
struct snd_pcm_ops e;
@@
e@i@p
@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct snd_pcm_ops i = { ... };
//
Signed-off-by: Juli
On Fri, 2 Sep 2016, Linus Torvalds wrote:
> On Fri, Sep 2, 2016 at 1:06 PM, Arnd Bergmann wrote:
> >
> > When I once looked, I thought all drivers using NO_IRQ were specific
> > to powerpc or one of the less common architectures.
>
> powerpc definitely does seem to be the biggest case, with abo
On Sun, 28 Aug 2016, SF Markus Elfring wrote:
> From: Markus Elfring
> Date: Sun, 28 Aug 2016 18:45:26 +0200
>
> Adjust jump labels according to the current Linux coding style convention.
>
> Signed-off-by: Markus Elfring
> ---
> arch/powerpc/kvm/e500_mmu.c | 9 -
> 1 file changed, 4
On Sun, 28 Aug 2016, SF Markus Elfring wrote:
> From: Markus Elfring
> Date: Sun, 28 Aug 2016 18:40:08 +0200
>
> * A multiplication for the size determination of a memory allocation
> indicated that an array data structure should be processed.
> Thus use the corresponding function "kmalloc_
On Fri, 5 Aug 2016, Robin Murphy wrote:
> Hi Julia,
>
> On 05/08/16 09:56, Julia Lawall wrote:
> > Use of_property_read_bool to check for the existence of a property.
>
> This caught my eye since Rob told me off for doing the same recently[1].
>
> > The semantic p
else S2
//
Signed-off-by: Julia Lawall
---
arch/powerpc/sysdev/mpic.c |2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 7de45b2..26d9c3f 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
else S2
//
Signed-off-by: Julia Lawall
---
drivers/soc/fsl/qe/qe_tdm.c |2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/soc/fsl/qe/qe_tdm.c b/drivers/soc/fsl/qe/qe_tdm.c
index 5e48b14..0ac98e6 100644
--- a/drivers/soc/fsl/qe/qe_tdm.c
+++ b/drivers/soc/fsl/qe/qe_tdm.c
Use of_property_read_bool to check for the existence of a property.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
//
@@
expression e1,e2;
statement S2,S1;
@@
- if (of_get_property(e1,e2,NULL))
+ if (of_property_read_bool(e1,e2))
S1 else
e_put(afu_np) call after the loop, where it's
> > guaranteed that afu_np == NULL.
> >
> > Reported-by: SF Markus Elfring
> > Reported-by: Julia Lawall
> > Signed-off-by: Andrew Donnellan
> >
> > ---
> >
> > Checked the of_node_put() with Fr
On Wed, 20 Jul 2016, SF Markus Elfring wrote:
> From: Markus Elfring
> Date: Wed, 20 Jul 2016 15:10:32 +0200
>
> The of_node_put() function tests whether its argument is NULL
> and then returns immediately.
> Thus the test around the call is not needed.
>
> This issue was detected by using the
Dma_pool_zalloc combines dma_pool_alloc and memset 0. The semantic patch
that makes this transformation is as follows: (http://coccinelle.lip6.fr/)
//
@@
type T;
T *d;
expression e;
statement S;
@@
d =
-dma_pool_alloc
+dma_pool_zalloc
(...);
- memset(d, 0, sizeof(*d));
//
Signed-off-by: Julia Lawall
---
drivers/dma/fsldma.c |3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index aac85c3..a8828ed 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
These hv_ops structures are never modified, so declare them as const. Most
were const already.
Done with the help of Coccinelle.
Signed-off-by: Julia Lawall
---
drivers/tty/hvc/hvc_xen.c |4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/hvc/hvc_xen.c b
Add NULL test on call to devm_kzalloc.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
//
@@
expression x;
@@
* x = devm_kzalloc(...);
... when != x == NULL
*x
//
Signed-off-by: Julia Lawall
---
sound/soc/fsl/imx-pcm-dma.c |2 ++
1 file
Add NULL tests on various calls to kzalloc and devm_kzalloc.
The semantic match that finds these problems is as follows:
(http://coccinelle.lip6.fr/)
//
@@
expression x,y;
identifier fld;
@@
(
x = \(vmalloc\|kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|krealloc\|
kmemdup\|kstrdup\|
;
@@
for_each_node_by_name(n, e1) {
... when != of_node_put(n)
when != e = n
(
return n;
|
+ of_node_put(n);
? return ...;
)
...
}
//
Signed-off-by: Julia Lawall
---
arch/powerpc/platforms/cell/iommu.c |1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/platforms/cell/iommu.c
b
;
@@
for_each_node_by_type(n, e1) {
... when != of_node_put(n)
when != e = n
(
return n;
|
+ of_node_put(n);
? return ...;
)
...
}
//
Signed-off-by: Julia Lawall
---
arch/powerpc/kernel/machine_kexec_64.c |4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel
(n,...) {
...
(
of_node_put(n);
|
e = n
|
+ of_node_put(n);
? break;
)
...
}
... when != n
//
Signed-off-by: Julia Lawall
---
arch/powerpc/kernel/btext.c |4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel
;
@@
for_each_compatible_node(n,...) {
...
(
of_node_put(n);
|
e = n
|
+ of_node_put(n);
? break;
)
...
}
... when != n
//
Signed-off-by: Julia Lawall
---
arch/powerpc/platforms/powernv/opal-lpc.c |1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/platforms/powernv/opal-lpc.c
b/arch
://coccinelle.lip6.fr):
//
@@
expression e,e1;
local idexpression n;
@@
for_each_node_by_type(n, e1) {
... when != of_node_put(n)
when != e = n
(
return n;
|
+ of_node_put(n);
? return ...;
)
...
}
//
Signed-off-by: Julia Lawall
---
arch/powerpc/platforms/pseries/setup.c |3
idexpression n;
expression e;
@@
for_each_compatible_node(n,...) {
...
(
of_node_put(n);
|
e = n
|
+ of_node_put(n);
? break;
)
...
}
... when != n
//
Signed-off-by: Julia Lawall
---
arch/powerpc/platforms/embedded6xx/hlwd-pic.c |1 +
1 file changed, 1 insertion(+)
diff --git a/arch
The various for_each device_node iterators performs an of_node_get on each
iteration, so a break out of the loop requires an of_node_put.
The complete semantic patch that fixes this problem is
(http://coccinelle.lip6.fr):
//
@r@
local idexpression n;
expression e1,e2;
iterator name for_each_node
On Sun, 11 Oct 2015, Christophe JAILLET wrote:
> of_get_next_parent can be used to simplify the while() loop and
> avoid the need of a temp variable.
Can you do something with the loop in __of_translate_address, in
drivers/of/address.c? Is there not an iterator for this?
julia
>
> Signed-of
Please ignore. Wrong patch set.
On Sun, 5 Apr 2015, Julia Lawall wrote:
> From: Julia Lawall
>
> Initialize ret before returning on failure, as done elsewhere in the
> function.
>
> A simplified version of the semantic match that finds this problem is as
> follows: (http
From: Julia Lawall
Initialize ret before returning on failure, as done elsewhere in the
function.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
//
(
if@p1 (\(ret < 0\|ret != 0\))
{ ... return ret; }
|
ret@p1 = 0
)
... w
From: Julia Lawall
The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)
//
@r@
type T;
identifier f;
@@
static T f (...) { ... }
@@
identifier r.f;
declarer name EXPORT_SYMBOL;
@@
-EXPORT_SYMBOL(f);
//
Furthermore, the function is never used, so its
These patches remove EXPORT_SYMBOL or EXPORT_SYMBOL_GPL declarations on
static functions.
This was done using the following semantic patch:
(http://coccinelle.lip6.fr/)
//
@r@
type T;
identifier f;
@@
static T f (...) { ... }
@@
identifier r.f;
declarer name EXPORT_SYMBOL;
@@
-EXPORT_SYMBOL(f
From: Julia Lawall
Memset on a local variable may be removed when it is called just before the
variable goes out of scope. Using memzero_explicit defeats this
optimization. A simplified version of the semantic patch that makes this
change is as follows: (http://coccinelle.lip6.fr
Memset on a local variable may be removed when it is called just before the
variable goes out of scope. Using memzero_explicit defeats this
optimization. The complete semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)
//
@@
identifier x;
local idexpression e;
type
From: Julia Lawall
Memset on a local variable may be removed when it is called just before the
variable goes out of scope. Using memzero_explicit defeats this
optimization. A simplified version of the semantic patch that makes this
change is as follows: (http://coccinelle.lip6.fr
Memset on a local variable may be removed when it is called just before the
variable goes out of scope. Using memzero_explicit defeats this
optimization. The complete semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)
//
@@
identifier x;
local idexpression e;
type
Wrong patch, please ignore.
julia
On Sun, 23 Nov 2014, Julia Lawall wrote:
> From: Julia Lawall
>
> Initialize ret before returning on failure, as done elsewhere in the
> function.
>
> A simplified version of the semantic match that finds this problem is as
> follows: (h
From: Julia Lawall
Initialize ret before returning on failure, as done elsewhere in the
function.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
//
(
if@p1 (\(ret < 0\|ret != 0\))
{ ... return ret; }
|
ret@p1 = 0
)
... w
From: Julia Lawall
Simplify the error path to avoid calling of_node_put when it is not needed.
The semantic patch that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
//
@@
expression e;
@@
-if (e)
of_node_put(e);
//
Signed-off-by: Julia Lawall
---
v2: new subject
From: Julia Lawall
Simplify the error path to avoid calling of_node_put when it is not needed.
The semantic patch that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
//
@@
expression e;
@@
-if (e)
of_node_put(e);
//
Signed-off-by: Julia Lawall
---
arch/powerpc
1 - 100 of 186 matches
Mail list logo