2020-11-08 01:14:00

by Kaixu Xia

[permalink] [raw]
Subject: [PATCH v2] net: atlantic: Remove unnecessary conversion to bool

From: Kaixu Xia <[email protected]>

The '!=' expression itself is bool, no need to convert it to bool.
Fix the following coccicheck warning:

./drivers/net/ethernet/aquantia/atlantic/aq_nic.c:1477:34-39: WARNING: conversion to bool not needed here

Reported-by: Tosk Robot <[email protected]>
Signed-off-by: Kaixu Xia <[email protected]>
---
drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
index bf5e0e9bd0e2..6c049864dac0 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -1474,7 +1474,7 @@ int aq_nic_setup_tc_mqprio(struct aq_nic_s *self, u32 tcs, u8 *prio_tc_map)
for (i = 0; i < sizeof(cfg->prio_tc_map); i++)
cfg->prio_tc_map[i] = cfg->tcs * i / 8;

- cfg->is_qos = (tcs != 0 ? true : false);
+ cfg->is_qos = !!tcs;
cfg->is_ptp = (cfg->tcs <= AQ_HW_PTP_TC);
if (!cfg->is_ptp)
netdev_warn(self->ndev, "%s\n",
--
2.20.0


2020-11-10 23:33:18

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [PATCH v2] net: atlantic: Remove unnecessary conversion to bool

On Sun, 8 Nov 2020 09:11:59 +0800 [email protected] wrote:
> From: Kaixu Xia <[email protected]>
>
> The '!=' expression itself is bool, no need to convert it to bool.
> Fix the following coccicheck warning:
>
> ./drivers/net/ethernet/aquantia/atlantic/aq_nic.c:1477:34-39: WARNING: conversion to bool not needed here
>
> Reported-by: Tosk Robot <[email protected]>
> Signed-off-by: Kaixu Xia <[email protected]>

Applied.