* [PATCH v2] staging: comedi: Simplify conditional evaluation
@ 2020-10-19 14:45 Deepak R Varma
2020-10-19 16:51 ` Ian Abbott
0 siblings, 1 reply; 2+ messages in thread
From: Deepak R Varma @ 2020-10-19 14:45 UTC (permalink / raw)
To: outreachy-kernel, Greg Kroah-Hartman, Ian Abbott,
H Hartley Sweeten, devel
Cc: mh12gx2825
Boolean comparison of the condition inside unittest function is
unnecessary and can be simplified by directly using the condition
outcome for evaluation. Issue reported by :
scripts/coccinelle/misc/boolinit.cocci
Signed-off-by: Deepak R Varma <mh12gx2825@gmail.com>
---
Changes since v1:
- Corrected wrongly inverted tests. Feedback from Ian Abbott.
- Note:
This patch was sent earlier as part of a patch set containing 2
patches. The second patch of the patch set is dropped. Hence
sending this standalone patch as v2 version. This is based on the
feedback from Ian Abbott and Julia L.
drivers/staging/comedi/drivers/tests/ni_routes_test.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/comedi/drivers/tests/ni_routes_test.c b/drivers/staging/comedi/drivers/tests/ni_routes_test.c
index eaefaf596a37..4061b3b5f8e9 100644
--- a/drivers/staging/comedi/drivers/tests/ni_routes_test.c
+++ b/drivers/staging/comedi/drivers/tests/ni_routes_test.c
@@ -499,13 +499,13 @@ void test_route_register_is_valid(void)
const struct ni_route_tables *T = &private.routing_tables;
init_pci_fake();
- unittest(route_register_is_valid(4, O(4), T) == false,
+ unittest(!route_register_is_valid(4, O(4), T),
"check for bad source 4-->4\n");
- unittest(route_register_is_valid(0, O(1), T) == true,
+ unittest(route_register_is_valid(0, O(1), T),
"find first source\n");
- unittest(route_register_is_valid(4, O(6), T) == true,
+ unittest(route_register_is_valid(4, O(6), T),
"find middle source\n");
- unittest(route_register_is_valid(9, O(8), T) == true,
+ unittest(route_register_is_valid(9, O(8), T),
"find last source");
}
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] staging: comedi: Simplify conditional evaluation
2020-10-19 14:45 [PATCH v2] staging: comedi: Simplify conditional evaluation Deepak R Varma
@ 2020-10-19 16:51 ` Ian Abbott
0 siblings, 0 replies; 2+ messages in thread
From: Ian Abbott @ 2020-10-19 16:51 UTC (permalink / raw)
To: Deepak R Varma, outreachy-kernel, Greg Kroah-Hartman,
H Hartley Sweeten, devel
On 19/10/2020 15:45, Deepak R Varma wrote:
> Boolean comparison of the condition inside unittest function is
> unnecessary and can be simplified by directly using the condition
> outcome for evaluation. Issue reported by :
> scripts/coccinelle/misc/boolinit.cocci
>
> Signed-off-by: Deepak R Varma <mh12gx2825@gmail.com>
> ---
>
> Changes since v1:
> - Corrected wrongly inverted tests. Feedback from Ian Abbott.
> - Note:
> This patch was sent earlier as part of a patch set containing 2
> patches. The second patch of the patch set is dropped. Hence
> sending this standalone patch as v2 version. This is based on the
> feedback from Ian Abbott and Julia L.
>
> drivers/staging/comedi/drivers/tests/ni_routes_test.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/tests/ni_routes_test.c b/drivers/staging/comedi/drivers/tests/ni_routes_test.c
> index eaefaf596a37..4061b3b5f8e9 100644
> --- a/drivers/staging/comedi/drivers/tests/ni_routes_test.c
> +++ b/drivers/staging/comedi/drivers/tests/ni_routes_test.c
> @@ -499,13 +499,13 @@ void test_route_register_is_valid(void)
> const struct ni_route_tables *T = &private.routing_tables;
>
> init_pci_fake();
> - unittest(route_register_is_valid(4, O(4), T) == false,
> + unittest(!route_register_is_valid(4, O(4), T),
> "check for bad source 4-->4\n");
> - unittest(route_register_is_valid(0, O(1), T) == true,
> + unittest(route_register_is_valid(0, O(1), T),
> "find first source\n");
> - unittest(route_register_is_valid(4, O(6), T) == true,
> + unittest(route_register_is_valid(4, O(6), T),
> "find middle source\n");
> - unittest(route_register_is_valid(9, O(8), T) == true,
> + unittest(route_register_is_valid(9, O(8), T),
> "find last source");
> }
>
>
Looks OK to me. I have a minor quibble about the patch title. Maybe
change the tags to "staging: comedi: tests:" to narrow down the scope.
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
--
-=( Ian Abbott <abbotti@mev.co.uk> || MEV Ltd. is a company )=-
-=( registered in England & Wales. Regd. number: 02862268. )=-
-=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=-
-=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-10-19 16:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-19 14:45 [PATCH v2] staging: comedi: Simplify conditional evaluation Deepak R Varma
2020-10-19 16:51 ` Ian Abbott
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.