2022-10-09 16:15:09

by Valentin Vidić

[permalink] [raw]
Subject: [PATCH v2] staging: rtl8192e: cleanup if statements

Fix checkpatch warnings for if statements in rtl_wx.c:

CHECK: Comparison to NULL could be written "!expr"
CHECK: Using comparison to true is error prone
CHECK: braces {} should be used on all arms of this statement
CHECK: Unbalanced braces around else statement
CHECK: Alignment should match open parenthesis

Signed-off-by: Valentin Vidic <[email protected]>
---
v2: rebase and update description

drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
index 4920cb49e381..d8c4326fece0 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
@@ -313,7 +313,7 @@ static int _rtl92e_wx_get_range(struct net_device *dev,
/* ~130 Mb/s real (802.11n) */
range->throughput = 130 * 1000 * 1000;

- if (priv->rf_set_sens != NULL)
+ if (priv->rf_set_sens)
/* signal level threshold range */
range->sensitivity = priv->max_sens;

@@ -395,7 +395,7 @@ static int _rtl92e_wx_set_scan(struct net_device *dev,
rt_state = priv->rtllib->rf_power_state;
if (!priv->up)
return -ENETDOWN;
- if (priv->rtllib->LinkDetectInfo.bBusyTraffic == true)
+ if (priv->rtllib->LinkDetectInfo.bBusyTraffic)
return -EAGAIN;

if (wrqu->data.flags & IW_SCAN_THIS_ESSID) {
@@ -582,9 +582,9 @@ static int _rtl92e_wx_set_frag(struct net_device *dev,
if (priv->hw_radio_off)
return 0;

- if (wrqu->frag.disabled)
+ if (wrqu->frag.disabled) {
priv->rtllib->fts = DEFAULT_FRAG_THRESHOLD;
- else {
+ } else {
if (wrqu->frag.value < MIN_FRAG_THRESHOLD ||
wrqu->frag.value > MAX_FRAG_THRESHOLD)
return -EINVAL;
@@ -821,7 +821,7 @@ static int _rtl92e_wx_get_sens(struct net_device *dev,
{
struct r8192_priv *priv = rtllib_priv(dev);

- if (priv->rf_set_sens == NULL)
+ if (!priv->rf_set_sens)
return -1; /* we have not this support for this radio */
wrqu->sens.value = priv->sens;
return 0;
@@ -839,7 +839,7 @@ static int _rtl92e_wx_set_sens(struct net_device *dev,
return 0;

mutex_lock(&priv->wx_mutex);
- if (priv->rf_set_sens == NULL) {
+ if (!priv->rf_set_sens) {
err = -1; /* we have not this support for this radio */
goto exit;
}
@@ -882,7 +882,7 @@ static int _rtl92e_wx_set_encode_ext(struct net_device *dev,
u8 idx = 0, alg = 0, group = 0;

if ((encoding->flags & IW_ENCODE_DISABLED) ||
- ext->alg == IW_ENCODE_ALG_NONE) {
+ ext->alg == IW_ENCODE_ALG_NONE) {
ieee->pairwise_key_type = ieee->group_key_type
= KEY_TYPE_NA;
rtl92e_cam_reset(dev);
@@ -919,7 +919,7 @@ static int _rtl92e_wx_set_encode_ext(struct net_device *dev,
key, 0);
} else {
if ((ieee->pairwise_key_type == KEY_TYPE_CCMP) &&
- ieee->pHTInfo->bCurrentHTSupport)
+ ieee->pHTInfo->bCurrentHTSupport)
rtl92e_writeb(dev, 0x173, 1);
rtl92e_set_key(dev, 4, idx, alg,
(u8 *)ieee->ap_mac_addr, 0, key);
@@ -993,7 +993,7 @@ static int _rtl92e_wx_get_gen_ie(struct net_device *dev,
struct r8192_priv *priv = rtllib_priv(dev);
struct rtllib_device *ieee = priv->rtllib;

- if (ieee->wpa_ie_len == 0 || ieee->wpa_ie == NULL) {
+ if (ieee->wpa_ie_len == 0 || !ieee->wpa_ie) {
data->data.length = 0;
return 0;
}
--
2.30.2


2022-10-09 18:42:18

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v2] staging: rtl8192e: cleanup if statements

On Sun, Oct 09, 2022 at 06:05:34PM +0200, Valentin Vidic wrote:
> Fix checkpatch warnings for if statements in rtl_wx.c:
>
> CHECK: Comparison to NULL could be written "!expr"
> CHECK: Using comparison to true is error prone
> CHECK: braces {} should be used on all arms of this statement
> CHECK: Unbalanced braces around else statement
> CHECK: Alignment should match open parenthesis
>
> Signed-off-by: Valentin Vidic <[email protected]>
> ---
> v2: rebase and update description
>
> drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- Your patch did many different things all at once, making it difficult
to review. All Linux kernel patches need to only do one thing at a
time. If you need to do multiple things (such as clean up all coding
style issues in a file/driver), do it in a sequence of patches, each
one doing only one thing. This will make it easier to review the
patches to ensure that they are correct, and to help alleviate any
merge issues that larger patches can cause.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot