[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <004210bd-0ed1-58d5-0315-47499c850444@gmail.com>
Date: Sun, 9 Apr 2023 17:12:45 +0200
From: Philipp Hortmann <philipp.g.hortmann@...il.com>
To: Yogesh Hegde <yogi.kernel@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: rtl8192e: Fix comparison to NULL of variable
rf_set_sens
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@...il.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
Powered by blists - more mailing lists