From patchwork Sun Jul 24 20:23:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9245045 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 22FB460487 for ; Sun, 24 Jul 2016 20:23:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 13AAA25819 for ; Sun, 24 Jul 2016 20:23:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 079D3262FF; Sun, 24 Jul 2016 20:23:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB56625819 for ; Sun, 24 Jul 2016 20:23:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752240AbcGXUXi (ORCPT ); Sun, 24 Jul 2016 16:23:38 -0400 Received: from mout.web.de ([217.72.192.78]:59148 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751966AbcGXUXg (ORCPT ); Sun, 24 Jul 2016 16:23:36 -0400 Received: from [192.168.1.2] ([78.48.64.218]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0LxfOx-1bGt300SR1-017Fo4; Sun, 24 Jul 2016 22:23:25 +0200 Subject: [PATCH 3/3] staging: wilc1000: Reduce scope for a few variables in mac_ioctl() To: linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org, Austin Shin , Chris Park , Glen Lee , Greg Kroah-Hartman , Johnny Kim , Leo Kim , Tony Cho References: <5307CAA2.8060406@users.sourceforge.net> <530A086E.8010901@users.sourceforge.net> <530A72AA.3000601@users.sourceforge.net> <530B5FB6.6010207@users.sourceforge.net> <530C5E18.1020800@users.sourceforge.net> <530CD2C4.4050903@users.sourceforge.net> <530CF8FF.8080600@users.sourceforge.net> <530DD06F.4090703@users.sourceforge.net> <5317A59D.4@users.sourceforge.net> <558EB32E.6090003@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <702302e0-0056-9fff-7bb4-f54d4a0b0afc@users.sourceforge.net> Date: Sun, 24 Jul 2016 22:23:22 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 MIME-Version: 1.0 In-Reply-To: X-Provags-ID: V03:K0:mB5bNhohCTM+F+PMaqIsHSy2fcTTS3Cjx0KoQXTQXa6N0h0JePP 2vYbqZDYqydyaVXrVhxR/XTHftWqtkhrr9ol2RJyRa4OMq1zMRekN1B7Nck49P9P+Vve6XG nEuOUn4NdkvWTMTAvfoaDkssX8GJZLRq68tjJ06n3M6KdgmeRe1Noq1XCVMOGev0ppJyVcw Q6qmNnjIcgKdwiEWwK8lg== X-UI-Out-Filterresults: notjunk:1; V01:K0:zSQUTWglpP8=:oSZSvAy/F27aL4uAj4WdmE GqEh+ijh0ZC1xVB+p8riJrq2vr5kjCynJj/RfPRpO+92Eq0ziXJ9676y3MICrwXLVLmLckozp Wvw+e9hUv+PALpKoTEy8jmwCq0r0oB5dS2YTxQTfGi22WdO1PD+A6qxpQYTDiqr+xa/27iXgl HsEDNWkllPCtaUZIgN1S3eCNbh+PbllkWYqPGJn++JKOtb3PM6tgpWOGYy5Op4/aWkBvr+xrs 5YafcqEp1ucynaQ3ZN/bv/pm/BPpV/I15ODiNPoRJExSHNahYvgiRlBGJ7rBxd7ZN0CGg95M3 K+O4jHTUNd0HgURlNeGQDZCzG0lrsaDog/6zVgspK2H9Px5cYp5Yn8DBLN1scrOdPWJ3ILugS rGrS55cnP/xSY044L16fSRrjIsD/0wfNwyk/HJqPGAEFs5BBCMWNU+K86WkhuIwiVqkORSN6M EsZ5WQE4rxOFw5/SaQ5e8kSukibbjENqu+jYRkDA1itcXKuRYtO9x1gTW0OAf51RvDWhsTMnN mOapsWzVRD2xxdNvuUAjZ5U14zpLaW6UAKXJWNEwoRFhd+404xtrEh4wt3yNH/xsEVWkwnRpc MhcQiGbSe9XMDFsWZ0h4rqOhaWb6Nhxgq2LwWKHx2w3iy2ELlQ8PFk2xYEJF3PUZ7JxFsA7Ji urlvihgCjrtJA5MDRIWiWXEWQSi8t0smX/aK67TCIep69kV2v9vjKS63GgpEQJ1Ts6NIiQXXZ 0Rkx9YmkXCPioadR543k2g+CQ1okn+OMqr2OluTdeSLQLSkRsVWYvUGhLG4qAnUy6y4yDC9IN WyRYQeQ Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sun, 24 Jul 2016 21:45:37 +0200 Three local variables were used only within a single case branch. * Thus move the data type definition for "rssi" and "size" into the corresponding code block. * The variable "length" was not modified after its initialisation. Thus pass a constant value in the affected function call instead. Signed-off-by: Markus Elfring --- drivers/staging/wilc1000/linux_wlan.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 7b1ebcc..173be16 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1094,8 +1094,6 @@ int wilc_mac_close(struct net_device *ndev) static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) { u8 *buff = NULL; - s8 rssi; - u32 size = 0, length = 0; struct wilc_vif *vif; s32 ret = 0; struct wilc *wilc; @@ -1110,8 +1108,7 @@ static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) case SIOCSIWPRIV: { struct iwreq *wrq = (struct iwreq *)req; - - size = wrq->u.data.length; + u32 size = wrq->u.data.length; if (size && wrq->u.data.pointer) { buff = memdup_user(wrq->u.data.pointer, @@ -1119,7 +1116,9 @@ static int mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd) if (IS_ERR(buff)) return PTR_ERR(buff); - if (strncasecmp(buff, "RSSI", length) == 0) { + if (strncasecmp(buff, "RSSI", 0) == 0) { + s8 rssi; + ret = wilc_get_rssi(vif, &rssi); netdev_info(ndev, "RSSI :%d\n", rssi);