* [PATCH 0/4] adjust double test
@ 2012-01-12 21:49 Julia Lawall
2012-01-12 21:49 ` [PATCH v2 1/5] drivers/staging: " Julia Lawall
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Julia Lawall @ 2012-01-12 21:49 UTC (permalink / raw)
To: linux-kernel; +Cc: kernel-janitors
These patches fix cases where there are two tests of the same expression.
Please ignore the previous versions of these patches, which were sent by
accident.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/5] drivers/staging: adjust double test
2012-01-12 21:49 [PATCH 0/4] adjust double test Julia Lawall
@ 2012-01-12 21:49 ` Julia Lawall
2012-01-12 21:49 ` [PATCH v2 2/5] drivers/media/video/s5p-fimc/fimc-capture.c: " Julia Lawall
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2012-01-12 21:49 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: kernel-janitors, devel, linux-kernel
From: Julia Lawall <Julia.Lawall@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.Lawall@lip6.fr>
---
The array has 4 elements, so my guess is that the one in position 3 should
be tested rather than testing the one in position 1 again.
drivers/staging/rtl8192e/rtllib_rx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c
index 6c5061f..13979b5 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -2453,7 +2453,7 @@ static inline void update_network(struct rtllib_network *dst,
if (src->wmm_param[0].ac_aci_acm_aifsn ||
src->wmm_param[1].ac_aci_acm_aifsn ||
src->wmm_param[2].ac_aci_acm_aifsn ||
- src->wmm_param[1].ac_aci_acm_aifsn)
+ src->wmm_param[3].ac_aci_acm_aifsn)
memcpy(dst->wmm_param, src->wmm_param, WME_AC_PRAM_LEN);
dst->SignalStrength = src->SignalStrength;
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/5] drivers/media/video/s5p-fimc/fimc-capture.c: adjust double test
2012-01-12 21:49 [PATCH 0/4] adjust double test Julia Lawall
2012-01-12 21:49 ` [PATCH v2 1/5] drivers/staging: " Julia Lawall
@ 2012-01-12 21:49 ` Julia Lawall
2012-01-12 21:49 ` [PATCH v2 3/5] drivers/dma/amba-pl08x.c: " Julia Lawall
2012-01-12 21:49 ` [PATCH 4/5] drivers/media/video/s5p-mfc/s5p_mfc.c: " Julia Lawall
3 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2012-01-12 21:49 UTC (permalink / raw)
To: Kyungmin Park
Cc: kernel-janitors, Sylwester Nawrocki, Mauro Carvalho Chehab,
linux-arm-kernel, linux-media, linux-kernel
From: Julia Lawall <Julia.Lawall@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.Lawall@lip6.fr>
---
There is a height field, so it is my guess that that should be tested
instead of testing the width field again.
drivers/media/video/s5p-fimc/fimc-capture.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c
index 2cc3b91..13dd598 100644
--- a/drivers/media/video/s5p-fimc/fimc-capture.c
+++ b/drivers/media/video/s5p-fimc/fimc-capture.c
@@ -689,7 +689,7 @@ static int fimc_pipeline_try_format(struct fimc_ctx *ctx,
mf->code = 0;
continue;
}
- if (mf->width != tfmt->width || mf->width != tfmt->width) {
+ if (mf->width != tfmt->width || mf->height != tfmt->height) {
u32 fcc = ffmt->fourcc;
tfmt->width = mf->width;
tfmt->height = mf->height;
@@ -698,7 +698,8 @@ static int fimc_pipeline_try_format(struct fimc_ctx *ctx,
NULL, &fcc, FIMC_SD_PAD_SOURCE);
if (ffmt && ffmt->mbus_code)
mf->code = ffmt->mbus_code;
- if (mf->width != tfmt->width || mf->width != tfmt->width)
+ if (mf->width != tfmt->width ||
+ mf->height != tfmt->height)
continue;
tfmt->code = mf->code;
}
@@ -706,7 +707,7 @@ static int fimc_pipeline_try_format(struct fimc_ctx *ctx,
ret = v4l2_subdev_call(csis, pad, set_fmt, NULL, &sfmt);
if (mf->code == tfmt->code &&
- mf->width == tfmt->width && mf->width == tfmt->width)
+ mf->width == tfmt->width && mf->height == tfmt->height)
break;
}
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 3/5] drivers/dma/amba-pl08x.c: adjust double test
2012-01-12 21:49 [PATCH 0/4] adjust double test Julia Lawall
2012-01-12 21:49 ` [PATCH v2 1/5] drivers/staging: " Julia Lawall
2012-01-12 21:49 ` [PATCH v2 2/5] drivers/media/video/s5p-fimc/fimc-capture.c: " Julia Lawall
@ 2012-01-12 21:49 ` Julia Lawall
2012-01-31 3:26 ` Vinod Koul
2012-01-12 21:49 ` [PATCH 4/5] drivers/media/video/s5p-mfc/s5p_mfc.c: " Julia Lawall
3 siblings, 1 reply; 6+ messages in thread
From: Julia Lawall @ 2012-01-12 21:49 UTC (permalink / raw)
To: Dan Williams; +Cc: kernel-janitors, Vinod Koul, linux-kernel
From: Julia Lawall <Julia.Lawall@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.Lawall@lip6.fr>
---
There is a dstbus field, so it is my guess that that should be tested
instead of testing the srcbus field again.
drivers/dma/amba-pl08x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index 8a28158..840c6c0 100644
--- a/drivers/dma/amba-pl08x.c
+++ b/drivers/dma/amba-pl08x.c
@@ -649,7 +649,7 @@ static int pl08x_fill_llis_for_desc(struct pl08x_driver_data *pl08x,
}
if ((bd.srcbus.addr % bd.srcbus.buswidth) ||
- (bd.srcbus.addr % bd.srcbus.buswidth)) {
+ (bd.dstbus.addr % bd.dstbus.buswidth)) {
dev_err(&pl08x->adev->dev,
"%s src & dst address must be aligned to src"
" & dst width if peripheral is flow controller",
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/5] drivers/media/video/s5p-mfc/s5p_mfc.c: adjust double test
2012-01-12 21:49 [PATCH 0/4] adjust double test Julia Lawall
` (2 preceding siblings ...)
2012-01-12 21:49 ` [PATCH v2 3/5] drivers/dma/amba-pl08x.c: " Julia Lawall
@ 2012-01-12 21:49 ` Julia Lawall
3 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2012-01-12 21:49 UTC (permalink / raw)
To: Kyungmin Park
Cc: kernel-janitors, Kamil Debski, Jeongtae Park,
Mauro Carvalho Chehab, linux-arm-kernel, linux-media,
linux-kernel
From: Julia Lawall <Julia.Lawall@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.Lawall@lip6.fr>
---
There is an img_height field, so it is my guess that that should be tested
instead of testing the img_width field again.
drivers/media/video/s5p-mfc/s5p_mfc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/video/s5p-mfc/s5p_mfc.c b/drivers/media/video/s5p-mfc/s5p_mfc.c
index 8be8b54..53126f2 100644
--- a/drivers/media/video/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/video/s5p-mfc/s5p_mfc.c
@@ -475,7 +475,7 @@ static void s5p_mfc_handle_seq_done(struct s5p_mfc_ctx *ctx,
ctx->mv_size = 0;
}
ctx->dpb_count = s5p_mfc_get_dpb_count();
- if (ctx->img_width == 0 || ctx->img_width == 0)
+ if (ctx->img_width == 0 || ctx->img_height == 0)
ctx->state = MFCINST_ERROR;
else
ctx->state = MFCINST_HEAD_PARSED;
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 3/5] drivers/dma/amba-pl08x.c: adjust double test
2012-01-12 21:49 ` [PATCH v2 3/5] drivers/dma/amba-pl08x.c: " Julia Lawall
@ 2012-01-31 3:26 ` Vinod Koul
0 siblings, 0 replies; 6+ messages in thread
From: Vinod Koul @ 2012-01-31 3:26 UTC (permalink / raw)
To: Julia Lawall; +Cc: Dan Williams, kernel-janitors, linux-kernel
On Thu, 2012-01-12 at 22:49 +0100, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@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.Lawall@lip6.fr>
>
> ---
> There is a dstbus field, so it is my guess that that should be tested
> instead of testing the srcbus field again.
>
> drivers/dma/amba-pl08x.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
> index 8a28158..840c6c0 100644
> --- a/drivers/dma/amba-pl08x.c
> +++ b/drivers/dma/amba-pl08x.c
> @@ -649,7 +649,7 @@ static int pl08x_fill_llis_for_desc(struct pl08x_driver_data *pl08x,
> }
>
> if ((bd.srcbus.addr % bd.srcbus.buswidth) ||
> - (bd.srcbus.addr % bd.srcbus.buswidth)) {
> + (bd.dstbus.addr % bd.dstbus.buswidth)) {
> dev_err(&pl08x->adev->dev,
> "%s src & dst address must be aligned to src"
> " & dst width if peripheral is flow controller",
>
Applied thanks
--
~Vinod
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-01-31 3:25 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-12 21:49 [PATCH 0/4] adjust double test Julia Lawall
2012-01-12 21:49 ` [PATCH v2 1/5] drivers/staging: " Julia Lawall
2012-01-12 21:49 ` [PATCH v2 2/5] drivers/media/video/s5p-fimc/fimc-capture.c: " Julia Lawall
2012-01-12 21:49 ` [PATCH v2 3/5] drivers/dma/amba-pl08x.c: " Julia Lawall
2012-01-31 3:26 ` Vinod Koul
2012-01-12 21:49 ` [PATCH 4/5] drivers/media/video/s5p-mfc/s5p_mfc.c: " Julia Lawall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).