staging: rtl8723bs: remove redundant ternary operators from return
PATCH v3 1/1 staging: rtl8723bs: remove redundant ternary operators from return
The Linux kernel coding style specifies that boolean expressions do not need a redundant ? true : false ternary operator. Additionally, return is not a function and therefore parentheses are not required.
---
Changes in v3:
- Formatted as a standalone patch (removed 1/3 series numbering).
drivers/staging/rtl8723bs/os_dep/osdep_service.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/os_dep/osdep_service.c +2 -2
@@ -130,7 +130,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 ; }/**
@@ -141,7 +141,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; }/**
Signature · 1 line
2.51.0.windows.1
Greg KH
maintainerQuoted 18 lines · Ashmit Kumar
The Linux kernel coding style specifies that boolean expressions do not need a redundant
? true : falseternary operator. Additionally, return is not a function and therefore parentheses are not required.Signed-off-by Ashmit Kumar <[email protected]>---
Changes in v3:
- Formatted as a standalone patch (removed 1/3 series numbering).drivers/staging/rtl8723bs/os_dep/osdep_service.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/rtl8723bs/os_dep/osdep_service.c +0
-0
drivers/staging/rtl8723bs/os_dep/osdep_service.c void rtw_buf_update(u8 **buf, u32 *buf_len, u8 *src, u32 src_len) · line 134
Quoted 6 lines
drivers/staging/rtl8723bs/os_dep/osdep_service.c +1
-1@@ -130,7 +130,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 ; }
This is only used in one place, right? Why not convert it to use a proper ring buffer instead?
drivers/staging/rtl8723bs/os_dep/osdep_service.c inline bool rtw_cbuf_full(struct rtw_cbuf *cbuf) · line 145
Quoted 8 lines
drivers/staging/rtl8723bs/os_dep/osdep_service.c +1
-1/** @@ -141,7 +141,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; }
Same here, only used once, why not use the proper data structure?
and same comments as on other one, slow down, full version info, etc.
thanks,
greg k-h