* [PATCH 5/12] drivers/parisc: Correct redundant test
@ 2009-07-27 16:13 Julia Lawall
2009-08-03 20:33 ` Grant Grundler
0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2009-07-27 16:13 UTC (permalink / raw)
To: kyle, deller, linux-parisc, linux-kernel, kernel-janitors
From: Julia Lawall <julia@diku.dk>
pa_pdc_cell has already been tested. It seems that this test should be on the
recently returned value io_pdc_cell.
A simplified version of the semantic match that finds this problem is as
follows: (http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@r exists@
local idexpression x;
expression E;
@@
if (x == NULL || ...) { ... when forall
return ...; }
... when != \(x=E\|x--\|x++\|--x\|++x\|x-=E\|x+=E\|x|=E\|x&=E\|&x\)
(
*x == NULL
|
*x != NULL
)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/parisc/lba_pci.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c
index ede6146..3aeb327 100644
--- a/drivers/parisc/lba_pci.c
+++ b/drivers/parisc/lba_pci.c
@@ -992,7 +992,7 @@ lba_pat_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev)
return;
io_pdc_cell = kzalloc(sizeof(pdc_pat_cell_mod_maddr_block_t), GFP_KERNEL);
- if (!pa_pdc_cell) {
+ if (!io_pdc_cell) {
kfree(pa_pdc_cell);
return;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 5/12] drivers/parisc: Correct redundant test
2009-07-27 16:13 [PATCH 5/12] drivers/parisc: Correct redundant test Julia Lawall
@ 2009-08-03 20:33 ` Grant Grundler
2009-08-04 2:27 ` Kyle McMartin
0 siblings, 1 reply; 3+ messages in thread
From: Grant Grundler @ 2009-08-03 20:33 UTC (permalink / raw)
To: Julia Lawall; +Cc: kyle, deller, linux-parisc, linux-kernel, kernel-janitors
On Mon, Jul 27, 2009 at 06:13:48PM +0200, Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
>
> pa_pdc_cell has already been tested. It seems that this test should be on the
> recently returned value io_pdc_cell.
>
> A simplified version of the semantic match that finds this problem is as
> follows: (http://www.emn.fr/x-info/coccinelle/)
>
> // <smpl>
> @r exists@
> local idexpression x;
> expression E;
> @@
>
> if (x == NULL || ...) { ... when forall
> return ...; }
> ... when != \(x=E\|x--\|x++\|--x\|++x\|x-=E\|x+=E\|x|=E\|x&=E\|&x\)
> (
> *x == NULL
> |
> *x != NULL
> )
> // </smpl>
>
> Signed-off-by: Julia Lawall <julia@diku.dk>
Good catch!
Reviewed-by: Grant Grundler <grundler@parisc-linux.org>
thanks,
grant
> ---
> drivers/parisc/lba_pci.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c
> index ede6146..3aeb327 100644
> --- a/drivers/parisc/lba_pci.c
> +++ b/drivers/parisc/lba_pci.c
> @@ -992,7 +992,7 @@ lba_pat_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev)
> return;
>
> io_pdc_cell = kzalloc(sizeof(pdc_pat_cell_mod_maddr_block_t), GFP_KERNEL);
> - if (!pa_pdc_cell) {
> + if (!io_pdc_cell) {
> kfree(pa_pdc_cell);
> return;
> }
> --
> To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-08-04 2:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-27 16:13 [PATCH 5/12] drivers/parisc: Correct redundant test Julia Lawall
2009-08-03 20:33 ` Grant Grundler
2009-08-04 2:27 ` Kyle McMartin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox