staging: rtl8192e: Fix comparison to NULL of variable rf_set_sens
Commit Message
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"
Signed-off-by: Yogesh Hegde <yogi.kernel@gmail.com>
---
drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Comments
On 4/9/23 15:10, Yogesh Hegde wrote:
> 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"
>
> Signed-off-by: Yogesh Hegde <yogi.kernel@gmail.com>
> ---
> drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
> index cb28288a618b..a67edb81a820 100644
> --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
> +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
> @@ -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;
> }
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
@@ -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;
}