From: Julia Lawall <julia.lawall@inria.fr>
To: Kushal Kothari <kushalkothari285@gmail.com>
Cc: gregkh@linuxfoundation.org, fabioaiuto83@gmail.com,
marcocesati@gmail.com, dan.carpenter@oracle.com,
ross.schm.dev@gmail.com, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org, outreachy-kernel@googlegroups.com,
mike.rapoport@gmail.com
Subject: Re: [Outreachy kernel] [PATCH] staging: rtl8723bs: core: Remove true and false comparison
Date: Tue, 19 Oct 2021 20:57:59 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.22.394.2110192057200.4042@hadrien> (raw)
In-Reply-To: <20211019172359.63583-1-kushalkothari285@gmail.com>
On Tue, 19 Oct 2021, Kushal Kothari wrote:
> Remove comparison to true and false in if statement.
> Issue found with checkpatch.pl.
> CHECK: Using comparison to true is error prone
> CHECK: Using comparison to false is error prone
>
> Signed-off-by: Kushal Kothari <kushalkothari285@gmail.com>
> ---
> drivers/staging/rtl8723bs/core/rtw_cmd.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> index efc9b1974e38..b473f1d1ce08 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> @@ -309,8 +309,8 @@ int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj)
> if (cmd_obj->cmdcode == GEN_CMD_CODE(_SetChannelPlan))
> bAllow = true;
>
> - if ((pcmdpriv->padapter->hw_init_completed == false && bAllow == false)
> - || atomic_read(&(pcmdpriv->cmdthd_running)) == false /* com_thread not running */
> + if ((!pcmdpriv->padapter->hw_init_completed && !bAllow)
> + || !atomic_read(&(pcmdpriv->cmdthd_running)) /* com_thread not running */
> )
> return _FAIL;
>
> @@ -407,7 +407,7 @@ int rtw_cmd_thread(void *context)
> break;
> }
>
> - if ((padapter->bDriverStopped == true) || (padapter->bSurpriseRemoved == true)) {
> + if ((padapter->bDriverStopped) || (padapter->bSurpriseRemoved)) {
The parentheses are pretty useless once you have removed the comparison.
julia
> netdev_dbg(padapter->pnetdev,
> "%s: DriverStopped(%d) SurpriseRemoved(%d) break at line %d\n",
> __func__, padapter->bDriverStopped,
> @@ -430,7 +430,7 @@ int rtw_cmd_thread(void *context)
> continue;
>
> _next:
> - if ((padapter->bDriverStopped == true) || (padapter->bSurpriseRemoved == true)) {
> + if ((padapter->bDriverStopped) || (padapter->bSurpriseRemoved)) {
> netdev_dbg(padapter->pnetdev,
> "%s: DriverStopped(%d) SurpriseRemoved(%d) break at line %d\n",
> __func__, padapter->bDriverStopped,
> @@ -927,7 +927,7 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 unicast_
> else
> GET_ENCRY_ALGO(psecuritypriv, sta, psetstakey_para->algorithm, false);
>
> - if (unicast_key == true)
> + if (unicast_key)
> memcpy(&psetstakey_para->key, &sta->dot118021x_UncstKey, 16);
> else
> memcpy(&psetstakey_para->key, &psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey, 16);
> @@ -1283,7 +1283,7 @@ u8 traffic_status_watchdog(struct adapter *padapter, u8 from_timer)
> (pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod > 2)) {
> bEnterPS = false;
>
> - if (bBusyTraffic == true) {
> + if (bBusyTraffic) {
> if (pmlmepriv->LinkDetectInfo.TrafficTransitionCount <= 4)
> pmlmepriv->LinkDetectInfo.TrafficTransitionCount = 4;
>
> @@ -1619,7 +1619,7 @@ static void rtw_chk_hi_queue_hdl(struct adapter *padapter)
>
> rtw_hal_get_hwreg(padapter, HW_VAR_CHK_HI_QUEUE_EMPTY, &empty);
>
> - while (false == empty && jiffies_to_msecs(jiffies - start) < g_wait_hiq_empty) {
> + while (!empty && jiffies_to_msecs(jiffies - start) < g_wait_hiq_empty) {
> msleep(100);
> rtw_hal_get_hwreg(padapter, HW_VAR_CHK_HI_QUEUE_EMPTY, &empty);
> }
> @@ -2054,7 +2054,7 @@ void rtw_setassocsta_cmdrsp_callback(struct adapter *padapter, struct cmd_obj *
>
> spin_lock_bh(&pmlmepriv->lock);
>
> - if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) && (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true))
> + if ((check_fwstate(pmlmepriv, WIFI_MP_STATE)) && (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)))
> _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
>
> set_fwstate(pmlmepriv, _FW_LINKED);
> --
> 2.25.1
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20211019172359.63583-1-kushalkothari285%40gmail.com.
>
prev parent reply other threads:[~2021-10-19 18:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-19 17:23 [PATCH] staging: rtl8723bs: core: Remove true and false comparison Kushal Kothari
2021-10-19 18:57 ` Julia Lawall [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.22.394.2110192057200.4042@hadrien \
--to=julia.lawall@inria.fr \
--cc=dan.carpenter@oracle.com \
--cc=fabioaiuto83@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=kushalkothari285@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=marcocesati@gmail.com \
--cc=mike.rapoport@gmail.com \
--cc=outreachy-kernel@googlegroups.com \
--cc=ross.schm.dev@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox