Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp1969074rwe; Sat, 15 Apr 2023 09:05:21 -0700 (PDT) X-Google-Smtp-Source: AKy350ZTxF7IemdmU9rlsGNzoqOyiAXhv5KrodYz4TGUKqcdvXM4yy+j2OznHg7BHeX7z0/eve59 X-Received: by 2002:a05:6a20:a10f:b0:ec:a118:6471 with SMTP id q15-20020a056a20a10f00b000eca1186471mr9821404pzk.50.1681574721527; Sat, 15 Apr 2023 09:05:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681574721; cv=none; d=google.com; s=arc-20160816; b=GXJNilYsFAauYx/sBaGVKerZrzi9A0QXNtvpDzaxR/IG8gO9jLFGib9A0RDQg2A6vs yhekfRIFyC76hbBU3hI8VRt0GY8ZLJcLcxaE3WjM6vIG0BkzomxMd6zvCGaMxrY9Qedl 3oBXCtpEhK4sNRi0VgMyQIQs3FqmKm1UmLVIqC03Phk7vciKOmodx+qfDevaiujdvYGt FiLPSf7bJqAR5bnXJIB7+EcGfSbSK20Iw1WXkp+Y8P0BRuGGydHaQRIVfObro+80Xjjb aEEHZOdABeLb7OYZsMic28tnRgu9FfAyqtiKF0nLMoyhoA9bX6G4l00jMRFXAtUND8Rv 0vdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=sLBPRU4tBDbcLsl+YlnO2kJLGMlsFh3f0WOghKh2dEs=; b=Vwu+ibqqBT2J9nsi8AchT1iBLa7PXpzGOkgu5cX3YWpBw3UDWafTgXczZHT3TTE4bY uc5q08de8loNqia823yuE43x9oLF81WAigiPL73PdC4aMCcToDtSh0k8HxndbPB6nAZF n0X+uWhqL6vyUYMTmiXah2hiNf1tuk/WsdTSPqUcdH8CBQuePB3F5LfzRyCHyV0zrqnl BGqIwddIKT92f5o3rfj9M3qLMeyaozt2wsdIum0sCjISkrewR8TlBMs5NTptYFr9DO6Y 5QESrzc+GWLy+qcXveiCHI/hBzsNroY5rOHy4EI341KupF5qyklYDvPsicTEPyCsAxau upIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="sL/SSxEu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v10-20020a63f20a000000b0050be7b93e73si2619211pgh.694.2023.04.15.09.04.44; Sat, 15 Apr 2023 09:05:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="sL/SSxEu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229678AbjDOQAw (ORCPT + 99 others); Sat, 15 Apr 2023 12:00:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229468AbjDOQAv (ORCPT ); Sat, 15 Apr 2023 12:00:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 843969B for ; Sat, 15 Apr 2023 09:00:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1E4E561590 for ; Sat, 15 Apr 2023 16:00:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25F8AC433D2; Sat, 15 Apr 2023 16:00:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1681574449; bh=D0HSWh6Smg0oJJDtN9Pl6WiCLYsAMPO6Nt5cBy3sWUU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sL/SSxEuoPCBxDhTtPJmESESa0ACu2su7njnLsY/7lyO6AbsaeqKOETHkD3HqZuUR 2n9pps8Ia3GIxyHCO/YYr5HELRURzrMZ/86Dm/FjnnTM6oMABIRzntk3DzVJ9tIXkU 5E6oNb35Up/3nVl59e5Vr7KZf0VH7D31tU2twFPg= Date: Sat, 15 Apr 2023 18:00:47 +0200 From: Greg Kroah-Hartman To: Yogesh Hegde Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Philipp Hortmann Subject: Re: [PATCH v3] staging: rtl8192e: Fix comparison to NULL of variable rf_set_sens Message-ID: <2023041537-probing-carpenter-cb71@gregkh> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 12, 2023 at 11:21:29PM +0530, Yogesh Hegde wrote: > Functions _rtl92e_wx_get_sens and _rtl92e_wx_set_sens depend on the > function rf_set_sens, which is declared but never defined. > Hence calling this function will cause an oops. So can an oops happen? I'm confused. > Because there is no definition of the function priv->rf_set_sens > will always be NULL. Ok, but is it used? I'm confused. > > As a result _rtl92e_wx_set_sens and _rtl92e_wx_get_sens will always > return -1. So it does work? Or it doesn't? What about the oops? > > Hence, > * Removed function definition rf_set_sens > * Removed usage of variable priv->rf_set_sens > * Removed functions _rtl92e_wx_get_sens and _rtl92e_wx_set_sens > * Cleaned up the variables sens and max_sens used in these functions "Hence" is an odd way to write this. And when you list things in a changelog, that usually means you want to have multiple patches, right? > Suggested-by: Philipp Hortmann > > Signed-off-by: Yogesh Hegde No blank line between these please. > --- > Changed in v3: > - Fixed description to fit within 75 chars > - Added suggested tags > > as Suggested by: Philipp Hortmann > > Changed in v2: > - Removed function definition rf_set_sens > - Removed usage of variable priv->rf_set_sens > - Removed functions _rtl92e_wx_get_sens and _rtl92e_wx_set_sens > - Cleaned up the variables sens and max_sens used in these functions > --- > drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 3 -- > drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 45 -------------------- > 2 files changed, 48 deletions(-) > > diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h > index 2b2d8af4cf6e..a949a3833cca 100644 > --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.h > +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h > @@ -234,7 +234,6 @@ struct r8192_priv { > struct rt_stats stats; > struct iw_statistics wstats; > > - short (*rf_set_sens)(struct net_device *dev, short sens); > u8 (*rf_set_chan)(struct net_device *dev, u8 ch); > > struct rx_desc *rx_ring[MAX_RX_QUEUE]; > @@ -274,8 +273,6 @@ struct r8192_priv { > short promisc; > > short chan; > - short sens; > - short max_sens; > bool ps_force; > > u32 irq_mask[2]; > diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c > index cb28288a618b..0bb657fda06c 100644 > --- a/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c > +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c > @@ -311,10 +311,6 @@ 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) > - /* signal level threshold range */ > - range->sensitivity = priv->max_sens; > - > range->max_qual.qual = 100; > range->max_qual.level = 0; > range->max_qual.noise = 0; > @@ -807,45 +803,6 @@ static int _rtl92e_wx_get_retry(struct net_device *dev, > return 0; > } > > -static int _rtl92e_wx_get_sens(struct net_device *dev, > - struct iw_request_info *info, > - union iwreq_data *wrqu, char *extra) > -{ > - struct r8192_priv *priv = rtllib_priv(dev); > - > - if (priv->rf_set_sens == NULL) > - return -1; /* we have not this support for this radio */ > - wrqu->sens.value = priv->sens; > - return 0; > -} > - > -static int _rtl92e_wx_set_sens(struct net_device *dev, > - struct iw_request_info *info, > - union iwreq_data *wrqu, char *extra) > -{ > - struct r8192_priv *priv = rtllib_priv(dev); > - > - short err = 0; > - > - if (priv->hw_radio_off) > - return 0; > - > - mutex_lock(&priv->wx_mutex); > - if (priv->rf_set_sens == NULL) { > - err = -1; /* we have not this support for this radio */ > - goto exit; > - } > - if (priv->rf_set_sens(dev, wrqu->sens.value) == 0) > - priv->sens = wrqu->sens.value; > - else > - err = -EINVAL; > - > -exit: > - mutex_unlock(&priv->wx_mutex); > - > - return err; > -} > - > static int _rtl92e_wx_set_encode_ext(struct net_device *dev, > struct iw_request_info *info, > union iwreq_data *wrqu, char *extra) > @@ -1066,8 +1023,6 @@ static iw_handler r8192_wx_handlers[] = { > [IW_IOCTL(SIOCGIWFREQ)] = _rtl92e_wx_get_freq, > [IW_IOCTL(SIOCSIWMODE)] = _rtl92e_wx_set_mode, > [IW_IOCTL(SIOCGIWMODE)] = _rtl92e_wx_get_mode, > - [IW_IOCTL(SIOCSIWSENS)] = _rtl92e_wx_set_sens, > - [IW_IOCTL(SIOCGIWSENS)] = _rtl92e_wx_get_sens, You are removing 2 ioctls, so at the minimum, this should be 2 different patches. Please make a patch series here and read up on how to write a bit better of a changelog text to make it more obvious what is happening here. thanks, greg k-h