* [PATCH] iop-adma, dmaengine: misplaced curly brackets?
@ 2009-02-25 12:56 Roel Kluin
2009-03-02 23:25 ` Dan Williams
0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2009-02-25 12:56 UTC (permalink / raw)
To: dan.j.williams; +Cc: lkml, Andrew Morton
I observed this by code inspection, and it was not tested in any way,
but aren't the curly brackets below wrong?
please review.
------------------------------>8-------------8<---------------------------------
Misplaced curly brackets.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
drivers/dma/iop-adma.c | 16 ++++++++--------
drivers/dma/mv_xor.c | 16 ++++++++--------
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c
index ea5440d..4131ab8 100644
--- a/drivers/dma/iop-adma.c
+++ b/drivers/dma/iop-adma.c
@@ -928,19 +928,19 @@ iop_adma_xor_zero_sum_self_test(struct iop_adma_device *device)
for (src_idx = 0; src_idx < IOP_ADMA_NUM_SRC_TEST; src_idx++) {
xor_srcs[src_idx] = alloc_page(GFP_KERNEL);
- if (!xor_srcs[src_idx])
- while (src_idx--) {
+ if (!xor_srcs[src_idx]) {
+ while (src_idx--)
__free_page(xor_srcs[src_idx]);
- return -ENOMEM;
- }
+ return -ENOMEM;
+ }
}
dest = alloc_page(GFP_KERNEL);
- if (!dest)
- while (src_idx--) {
+ if (!dest) {
+ while (src_idx--)
__free_page(xor_srcs[src_idx]);
- return -ENOMEM;
- }
+ return -ENOMEM;
+ }
/* Fill in src buffers */
for (src_idx = 0; src_idx < IOP_ADMA_NUM_SRC_TEST; src_idx++) {
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index d35cbd1..2a4e3e3 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -1019,19 +1019,19 @@ mv_xor_xor_self_test(struct mv_xor_device *device)
for (src_idx = 0; src_idx < MV_XOR_NUM_SRC_TEST; src_idx++) {
xor_srcs[src_idx] = alloc_page(GFP_KERNEL);
- if (!xor_srcs[src_idx])
- while (src_idx--) {
+ if (!xor_srcs[src_idx]) {
+ while (src_idx--)
__free_page(xor_srcs[src_idx]);
- return -ENOMEM;
- }
+ return -ENOMEM;
+ }
}
dest = alloc_page(GFP_KERNEL);
- if (!dest)
- while (src_idx--) {
+ if (!dest) {
+ while (src_idx--)
__free_page(xor_srcs[src_idx]);
- return -ENOMEM;
- }
+ return -ENOMEM;
+ }
/* Fill in src buffers */
for (src_idx = 0; src_idx < MV_XOR_NUM_SRC_TEST; src_idx++) {
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iop-adma, dmaengine: misplaced curly brackets?
2009-02-25 12:56 [PATCH] iop-adma, dmaengine: misplaced curly brackets? Roel Kluin
@ 2009-03-02 23:25 ` Dan Williams
0 siblings, 0 replies; 2+ messages in thread
From: Dan Williams @ 2009-03-02 23:25 UTC (permalink / raw)
To: Roel Kluin; +Cc: lkml, Andrew Morton
On Wed, Feb 25, 2009 at 5:56 AM, Roel Kluin <roel.kluin@gmail.com> wrote:
> I observed this by code inspection, and it was not tested in any way,
> but aren't the curly brackets below wrong?
>
> please review.
> ------------------------------>8-------------8<---------------------------------
> Misplaced curly brackets.
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
Yes, static analysis caught this error here recently as well. I have
applied your patch with a fixed up changelog:
commit d2076514c9ea68e7fef21158c1cdb8b244bfe5f2
Author: Roel Kluin <roel.kluin@gmail.com>
Date: Wed Feb 25 13:56:21 2009 +0100
iop-adma, mv_xor: fix mem leak on self-test setup failure
iop_adma_zero_sum_self_test has the brackets in the wrong place for the
setup failure deallocation path. This error was duplicated in
mv_xor_xor_self_test.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Thanks,
Dan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-03-02 23:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-25 12:56 [PATCH] iop-adma, dmaengine: misplaced curly brackets? Roel Kluin
2009-03-02 23:25 ` Dan Williams
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox