From patchwork Thu Apr 13 03:20:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yogesh Hegde X-Patchwork-Id: 82737 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp757078vqo; Wed, 12 Apr 2023 20:27:13 -0700 (PDT) X-Google-Smtp-Source: AKy350ZTQ/8AFwIc62i2ECob4WPr91vNqGcslArJan14uLpr/Q5cNjlTHdTmeQPewmMFi5W1dmmx X-Received: by 2002:a05:6a00:228d:b0:625:ce95:f2ba with SMTP id f13-20020a056a00228d00b00625ce95f2bamr1563701pfe.22.1681356433236; Wed, 12 Apr 2023 20:27:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681356433; cv=none; d=google.com; s=arc-20160816; b=Fq+q+7bdHDd5TtOUzZWrGmfJyYdcSIZF754sgAcEG2RA8em3FRj2nmf9Z5ih1xTnBq Vd4i4kFd3e55NZ6qnUsZBgWvFnO4EokxrTLMjVZElfBPTtLe0NH5ZY2tK0jFb2K0Qm38 HVQoZ6KTqf8S8EDjGZ57mTDd4nYI76FRSeUUa/S0GXZ9/WfQ8WD2qCXr2yezjsOMkiUd x6rwyuOHUTtw86/rl5hZcZwAhy3OHajt1ZV8LvVFGRpN23Q+CurlQbal2CcFrY4PWCRr kyZJeIqV4b9VEMsggbHlq3B4g1R1KaGsk/bJuLdReNYSIXQz46enZc0GUgxqT+j6arcJ 2uOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=Z4RSl7MgASHbzKIb7HhpZajJUXMszG/Shm2pafDVnjk=; b=AcgWt6/laG42olr9szyosF+KJatP1hs1JQ4v50npx5LlqxCEoupbLjXu5SYFDImDWt EXASrq05kIV7e650PgphzPgLd9UamFdY+0DYUJAAV0EzUrMIFrpTBs7gK40K+9ZXkG0P UdskNN7VY2NT8+XWCFH4dGuAdRnusV6iTrbot8S/szT1ZDlMKlph5uaMRgNHRukCMsZd 9SvMr7A6VTFG/9osTJgN2Se2f27m822CHSfSnqWyIZlfoyIGiBhgk8G5zPAyjSi7OZT1 dVua/BVBh9TVQK27hOkYl+MFvaqyFX/1ErTkrsGVnhswbngpkQKJ30ZVqBNFHpG2L4E9 htjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=qzaGpjnJ; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b13-20020a6541cd000000b0050bdfdf4a66si870622pgq.147.2023.04.12.20.27.01; Wed, 12 Apr 2023 20:27:13 -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=@gmail.com header.s=20221208 header.b=qzaGpjnJ; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229622AbjDMDUY (ORCPT + 99 others); Wed, 12 Apr 2023 23:20:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229564AbjDMDUW (ORCPT ); Wed, 12 Apr 2023 23:20:22 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C03054683 for ; Wed, 12 Apr 2023 20:20:17 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id kh6so12058811plb.0 for ; Wed, 12 Apr 2023 20:20:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681356017; x=1683948017; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=Z4RSl7MgASHbzKIb7HhpZajJUXMszG/Shm2pafDVnjk=; b=qzaGpjnJ7PckXQI5bl8QNUYnqNY9xzcX8MolKXiByTmUx42X79Ec5E91+W+NB4IBBu Lj5fAZKHMS4mGloxAqwT/AL3IY4RP+RT+PKbKEpIEe2PgXE7HOMq9mq82QeLZFLG0bRh 5YMe5dSOEd7BRFtnC7skjHVc0OZdt5AG/KIsJKNS8p4xZszonCCByHbBfEomtVtOfcoO g7zvC9+L/Uyy+nwnQESSZYt7/gXYJ696JLoeOs2hVL7oC2f4TeHo54vIFHfK5m2INQS9 JKjr436yAp10Y2VumV8qbVNJwEhyHPlIYWfaw13UQQne5/zHgf/+QsTYa7V4U7H+6L3H /L8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681356017; x=1683948017; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Z4RSl7MgASHbzKIb7HhpZajJUXMszG/Shm2pafDVnjk=; b=KCj5FPj/uQWSgYCuALFwrd1+/M/XlOJ74wcYHt1kHeogilxXl0+8TAeJ+DoZ5InRky iau9E07cGJSUy0phMpUxU188SVgvoYoIZffd0CT+J3K1n5VkKF1RcaTqP68GCF9roJav /bWDL+wOPVfr7336cW+o8d1YlJjzR6dYzpPsF7PXE/pUWgdS9dAyJmqblfJEKiBLUdC/ uSfTU368gXx8z6WCBDEwn0HgT3wyHQ+uDRdj/7b9NY2e2bPJ0K77L1bpQ4couzmezKKI HdvoetGwgqfaSv6D8gWr8TPUiO/Z/c/xOrgEltymq5Xfi4JEYNkaWmkvHM1Qu6wgRIvx NrpQ== X-Gm-Message-State: AAQBX9dyenGYRs/BOeJeSV33/LK+kQeux+9i1eJdM0puUxKQEqIkyoAu L6SZVS1p3NW2RN3FrDnG90o= X-Received: by 2002:a17:903:114:b0:1a5:2809:97f3 with SMTP id y20-20020a170903011400b001a5280997f3mr594763plc.14.1681356017131; Wed, 12 Apr 2023 20:20:17 -0700 (PDT) Received: from Zephyrus-G14 ([103.251.210.208]) by smtp.gmail.com with ESMTPSA id u1-20020a170902a60100b001a671a396efsm299493plq.214.2023.04.12.20.20.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Apr 2023 20:20:16 -0700 (PDT) Date: Thu, 13 Apr 2023 08:50:12 +0530 From: Yogesh Hegde To: Greg Kroah-Hartman , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: Philipp Hortmann Subject: [PATCH] staging: rtl8192u: Remove functions rtl8192_wx_get_sens and rtl8192_wx_set_sens Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763030003316607384?= X-GMAIL-MSGID: =?utf-8?q?1763030003316607384?= Both of these functions depend on the function rf_set_sens, which is declared but never defined. Hence calling this function will cause an oops. Because there is no definition of the function, priv->rf_set_sens will always be NULL. As a result rtl8192_wx_set_sens and rtl8192_wx_get_sens will always return -1. Hence, * Removed function definition rf_set_sens * Removed usage of variable priv->rf_set_sens * Removed functions rtl8192_wx_get_sens and rtl8192_wx_set_sens * Cleaned up the variables sens and max_sens used in these functions Suggested-by: Philipp Hortmann Signed-off-by: Yogesh Hegde --- drivers/staging/rtl8192u/r8192U.h | 3 --- drivers/staging/rtl8192u/r8192U_wx.c | 40 ++-------------------------- 2 files changed, 2 insertions(+), 41 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h index ff0ada00bf41..7da15b03519c 100644 --- a/drivers/staging/rtl8192u/r8192U.h +++ b/drivers/staging/rtl8192u/r8192U.h @@ -842,8 +842,6 @@ typedef struct r8192_priv { u16 irq_mask; short chan; - short sens; - short max_sens; short up; /* If 1, allow bad crc frame, reception in monitor mode */ @@ -854,7 +852,6 @@ typedef struct r8192_priv { enum rt_rf_type rf_type; /* 0: 1T2R, 1: 2T4R */ RT_RF_TYPE_819xU rf_chip; - short (*rf_set_sens)(struct net_device *dev, short sens); u8 (*rf_set_chan)(struct net_device *dev, u8 ch); void (*rf_close)(struct net_device *dev); void (*rf_init)(struct net_device *dev); diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c index 203ea3bfc843..2852f79204c0 100644 --- a/drivers/staging/rtl8192u/r8192U_wx.c +++ b/drivers/staging/rtl8192u/r8192U_wx.c @@ -250,8 +250,6 @@ static int rtl8180_wx_get_range(struct net_device *dev, /* range->old_num_channels; */ /* range->old_num_frequency; */ /* range->old_freq[6]; */ /* Filler to keep "version" at the same offset */ - if (priv->rf_set_sens) - range->sensitivity = priv->max_sens; /* signal level threshold range */ range->max_qual.qual = 100; /* TODO: Find real max RSSI and stick here */ @@ -662,40 +660,6 @@ static int r8192_wx_get_retry(struct net_device *dev, return 0; } -static int r8192_wx_get_sens(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct r8192_priv *priv = ieee80211_priv(dev); - - if (!priv->rf_set_sens) - return -1; /* we have not this support for this radio */ - wrqu->sens.value = priv->sens; - return 0; -} - -static int r8192_wx_set_sens(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct r8192_priv *priv = ieee80211_priv(dev); - short err = 0; - - mutex_lock(&priv->wx_mutex); - if (!priv->rf_set_sens) { - 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; -} /* hw security need to reorganized. */ static int r8192_wx_set_enc_ext(struct net_device *dev, @@ -825,8 +789,8 @@ static iw_handler r8192_wx_handlers[] = { r8192_wx_get_freq, /* SIOCGIWFREQ */ r8192_wx_set_mode, /* SIOCSIWMODE */ r8192_wx_get_mode, /* SIOCGIWMODE */ - r8192_wx_set_sens, /* SIOCSIWSENS */ - r8192_wx_get_sens, /* SIOCGIWSENS */ + NULL, /* SIOCSIWSENS */ + NULL, /* SIOCGIWSENS */ NULL, /* SIOCSIWRANGE */ rtl8180_wx_get_range, /* SIOCGIWRANGE */ NULL, /* SIOCSIWPRIV */