Skip to contentSkip to conversation

staging: rtl8192e: Fix comparison to NULL of variable rf_set_sens

PATCH Superseded Yogesh Hegde 2 participants 2 messages Apr 9, 2023 Staging

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8192e: Fix comparison to NULL of variable rf_set_sens

Fix comparision to NULL of variable rf_set_sens as per Linux kernel coding-style. These issues were reported by checkpatch.pl.

CHECK: Comparison to NULL could be written "priv->rf_set_sens"
CHECK: Comparison to NULL could be written "!priv->rf_set_sens"

---
 drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +3 -3
index cb28288a618b..a67edb81a820 100644
@@ -311,7 +311,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;
 
@@ -813,7 +813,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;
@@ -831,7 +831,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;
 	}
Signature · 1 line
2.34.1
#1 lore raw
Quoted 34 lines · Yogesh Hegde

Fix comparision to NULL of variable rf_set_sens as per Linux kernel coding-style. These issues were reported by checkpatch.pl.

CHECK: Comparison to NULL could be written "priv->rf_set_sens"
CHECK: Comparison to NULL could be written "!priv->rf_set_sens"

---
  drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +2 -2
index cb28288a618b..a67edb81a820 100644
@@ -311,7 +311,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;
 
@@ -813,7 +813,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;

drivers/staging/rtl8192e/rtl8192e/rtl_wx.c static int _rtl92e_wx_set_sens(struct net_device *dev, · line 837

Quoted 8 lines
drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +1 -1
@@ -831,7 +831,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;
  	}

I would like you to do more.
I you search for rf_set_sens you will see that it is declared as a function.
But there is no definition of the function which will cause an oops when this function is called.

Because there is no definition of the function the priv->rf_set_sens will result always NULL

Bye Philipp