Re: [PATCH] staging: ccree: Fix bool comparison

From: Tobin C. Harding
Date: Mon Oct 16 2017 - 17:17:18 EST


On Mon, Oct 16, 2017 at 03:38:11PM +0530, sunil.m@xxxxxxxxxxxx wrote:
> From: Suniel Mahesh <sunil.m@xxxxxxxxxxxx>
>
> Bool tests don't need comparisons.

This commit log could be a bit longer. You may like to read
Documentation/process/submitting-patches.rst (section 2).

> This fixes the following coccinelle warning:
> WARNING: Comparison of bool to 0/1
>
> Signed-off-by: Suniel Mahesh <sunil.m@xxxxxxxxxxxx>
> ---
> Note:
> - Patch was tested and built(ARCH=arm) on latest
> linux-next.

Building is _not_ testing.

> - No build issues reported, however it was not
> tested on real hardware.

This is implicit if you state 'builds on ARM'

> - Please discard this changeset, if this is not
> helping the code look better.

This is implicit also ;)

> ---
> drivers/staging/ccree/ssi_request_mgr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c
> index 2e0df57..942afe2 100644
> --- a/drivers/staging/ccree/ssi_request_mgr.c
> +++ b/drivers/staging/ccree/ssi_request_mgr.c
> @@ -272,7 +272,7 @@ int send_request(
> unsigned int max_required_seq_len = (total_seq_len +
> ((ssi_req->ivgen_dma_addr_len == 0) ? 0 :
> SSI_IVPOOL_SEQ_LEN) +
> - ((is_dout == 0) ? 1 : 0));
> + (!is_dout ? 1 : 0));

Perhaps

- ((is_dout == 0) ? 1 : 0));
+ (is_dout ? 0 : 1)

Good luck,
Tobin.