* [PATCH] staging: rtl8723bs: drop redundant conversion to bool
@ 2025-08-27 3:15 Xichao Zhao
2025-08-27 8:02 ` Dan Carpenter
0 siblings, 1 reply; 2+ messages in thread
From: Xichao Zhao @ 2025-08-27 3:15 UTC (permalink / raw)
To: gregkh; +Cc: linux-staging, linux-kernel, Xichao Zhao
The result of integer comparison already evaluates to bool. No need for
explicit conversion.
No functional impact.
Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
---
drivers/staging/rtl8723bs/core/rtw_mlme.c | 6 +++---
drivers/staging/rtl8723bs/os_dep/osdep_service.c | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index 692d0c2b766d..570c99192d3f 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -1597,7 +1597,7 @@ inline bool rtw_is_scan_deny(struct adapter *adapter)
{
struct mlme_priv *mlmepriv = &adapter->mlmepriv;
- return (atomic_read(&mlmepriv->set_scan_deny) != 0) ? true : false;
+ return (atomic_read(&mlmepriv->set_scan_deny) != 0);
}
inline void rtw_clear_scan_deny(struct adapter *adapter)
@@ -2136,8 +2136,8 @@ void rtw_ht_use_default_setting(struct adapter *padapter)
else
phtpriv->bss_coexist = 0;
- phtpriv->sgi_40m = TEST_FLAG(pregistrypriv->short_gi, BIT1) ? true : false;
- phtpriv->sgi_20m = TEST_FLAG(pregistrypriv->short_gi, BIT0) ? true : false;
+ phtpriv->sgi_40m = TEST_FLAG(pregistrypriv->short_gi, BIT1);
+ phtpriv->sgi_20m = TEST_FLAG(pregistrypriv->short_gi, BIT0);
/* LDPC support */
rtw_hal_get_def_var(padapter, HAL_DEF_RX_LDPC, (u8 *)&bHwLDPCSupport);
diff --git a/drivers/staging/rtl8723bs/os_dep/osdep_service.c b/drivers/staging/rtl8723bs/os_dep/osdep_service.c
index a00f9f0c85c5..509d00321b10 100644
--- a/drivers/staging/rtl8723bs/os_dep/osdep_service.c
+++ b/drivers/staging/rtl8723bs/os_dep/osdep_service.c
@@ -161,7 +161,7 @@ void rtw_buf_update(u8 **buf, u32 *buf_len, u8 *src, u32 src_len)
*/
inline bool rtw_cbuf_full(struct rtw_cbuf *cbuf)
{
- return (cbuf->write == cbuf->read - 1) ? true : false;
+ return (cbuf->write == cbuf->read - 1);
}
/**
@@ -172,7 +172,7 @@ inline bool rtw_cbuf_full(struct rtw_cbuf *cbuf)
*/
inline bool rtw_cbuf_empty(struct rtw_cbuf *cbuf)
{
- return (cbuf->write == cbuf->read) ? true : false;
+ return (cbuf->write == cbuf->read);
}
/**
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] staging: rtl8723bs: drop redundant conversion to bool
2025-08-27 3:15 [PATCH] staging: rtl8723bs: drop redundant conversion to bool Xichao Zhao
@ 2025-08-27 8:02 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2025-08-27 8:02 UTC (permalink / raw)
To: Xichao Zhao; +Cc: gregkh, linux-staging, linux-kernel
On Wed, Aug 27, 2025 at 11:15:00AM +0800, Xichao Zhao wrote:
> The result of integer comparison already evaluates to bool. No need for
> explicit conversion.
>
> No functional impact.
>
> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
> ---
> drivers/staging/rtl8723bs/core/rtw_mlme.c | 6 +++---
> drivers/staging/rtl8723bs/os_dep/osdep_service.c | 4 ++--
> 2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
> index 692d0c2b766d..570c99192d3f 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
> @@ -1597,7 +1597,7 @@ inline bool rtw_is_scan_deny(struct adapter *adapter)
> {
> struct mlme_priv *mlmepriv = &adapter->mlmepriv;
>
> - return (atomic_read(&mlmepriv->set_scan_deny) != 0) ? true : false;
> + return (atomic_read(&mlmepriv->set_scan_deny) != 0);
mlmepriv->set_scan_deny is either 0 or 1 so it's cleaner to just do:
return atomic_read(&mlmepriv->set_scan_deny);
(avoids the double negative).
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-27 8:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-27 3:15 [PATCH] staging: rtl8723bs: drop redundant conversion to bool Xichao Zhao
2025-08-27 8:02 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox