Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp978075ybz; Sat, 25 Apr 2020 08:20:33 -0700 (PDT) X-Google-Smtp-Source: APiQypI0HFYAeAw//deN4L2OWXNH2DFuuGKbZ+c2yOUrDrqDkAf1B+fU22OfPOs7dYNig4ygH16T X-Received: by 2002:a17:906:4810:: with SMTP id w16mr11728927ejq.226.1587828033160; Sat, 25 Apr 2020 08:20:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587828033; cv=none; d=google.com; s=arc-20160816; b=YqhhNkBo0C9Tla42VInxnh4456V9EZYI/dtS3Nw/57xhI+DfO2NybfoXcgGYdroAtv RU5ih34QWWAOUoXw4HA608G0djpvUnjNTV9Sui3QXA78MNnS/hIL5AA8747NBcE8B5MI 9MiV8utW4MqZ83XM34CLi9qYNekG1p5Itau86LOs1SWzP2b0KQdY0lUh+R1QALrIxJxr fhbv20nbRRFBX9J1zyj4D1HDNki1pXKQahwHEsB4mbeGRh3gAfdrkvLao4T8mQ9TL781 XduiQ794wROScX1y2Q+MS01mpbU9s2Xvtg9Q8ZdDXHRyYE2/khyM5GS8Wh55lH2QqnDw A25w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JRPywCEWQ73srxh8QpZYrtq2sk5wSUuhGmgixzxLIlw=; b=XS6i/qRcG7ivYNAnDHWy5Vfq+PSoENIAZ32nKENanUbGxcSGezsWiy9l/K/XKrT5UJ e4b1D/JjrjXMGKB115AhL7Pj7Dxs2KU40eYGLAdioOhRuxROS6U4UtC7Xbjbwqhakd/E LfxWiAbNdhwsiLPsXCKp0mgDARnhnDGc1qb3uAxfzVYzfQoFirMFE1WTmaviMW6d5o6U akPyblAyNWQ2YrbewW2kystZ1Zws+6q2izWnuwuslsVS25+8+yxklsXyi7ScXvhlqaEX v5XBL/gE/d4YqMkeTMs+VsXH3DeufWhFa76H0JhZ3Nrx+s5ylR+krL3uYk7u7pW5c9wc TjPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=X3I87GoS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d13si3964308eds.361.2020.04.25.08.20.07; Sat, 25 Apr 2020 08:20:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=X3I87GoS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726150AbgDYPSn (ORCPT + 99 others); Sat, 25 Apr 2020 11:18:43 -0400 Received: from mout.gmx.net ([212.227.17.22]:46269 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726062AbgDYPSm (ORCPT ); Sat, 25 Apr 2020 11:18:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1587827912; bh=cA51MhRZpcPdbhzkfNM7piuf/X+QYuleTh22MsKRiKw=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=X3I87GoSnPyL8s2ODGDy2KCvF2hm5TvdAVuWW57qtfuAkYWr3Fa5XxA1Pg8/EYV6w VnhIT4p0UqL0DZPBTJO9a5a0kdY3MkYV87MGmgoKKP5ByMZYOt89nBa3LPMeYN/MWP QQB1piA/siKx46T30a9+GvXuw3DSply5kBJQzXvw= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([83.52.229.196]) by mail.gmx.com (mrgmx104 [212.227.17.174]) with ESMTPSA (Nemesis) id 1M3UV8-1jSunt3qx0-000aUU; Sat, 25 Apr 2020 17:18:32 +0200 From: Oscar Carter To: Forest Bond , Greg Kroah-Hartman Cc: Oscar Carter , Malcolm Priestley , Quentin Deslandes , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Joe Perches Subject: [PATCH v2 1/3] staging: vt6656: Remove the local variable "array" Date: Sat, 25 Apr 2020 17:17:45 +0200 Message-Id: <20200425151747.8199-2-oscar.carter@gmx.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200425151747.8199-1-oscar.carter@gmx.com> References: <20200425151747.8199-1-oscar.carter@gmx.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:gtIJ+SEoH+JonF2jdvTPXSN3dsz/lsGn1B6tAzfDsVuUMy5GXqf +EFo2IDXEKIX3XWUU4gbokazSnCF8GiOV7ZOUIPpAiajjlkmT1z2TcogyDgLER5RRBlEJqU CN+yjZEqpH/QdgMRQTjFZjiAeNnVBIBcE3tmQXvXPloytKXxgDW/nnfFB2JRqROxZS8LwaV o4k5AQeaZzntR7thLRlSQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:9mGWbtIyyQM=:6/HgujUBCrXsNwAZdHzf2r BzWK+7anO1LYpyw5gScTLiimGdwV6O+7ViUWsWz7r6/Q5GdbSDknO2Ax4vbSWgxJPg+DbdTwG JQ8p7GPry+jeSLmQNL3CtvFE/1jtdPoSVnFrbbFs0Tjw9cC1irUwuhYvPpsI0Mb0mpYsVLnV8 V/KuJK5Yzn3696Nuv5cCY5nsMRJ9Y6YsrQNc77/kGH+i314vsB6LOic/SnmIMKfraIDy14KZ/ RFV5iOsgU0FTRGki6We9M565/a9N8Se2/LE3ux0ib7W7PlbFLYIOySgAAKNgc8MOEtVHur8Wt e4ejuEi6F+MmXbHp4YMhs4w202G1TSFrAk1izgRAukYe5EvQfrc0i0DwyrupXpsrffKhS9qjI 0MIy0gEuECnOmCQnb7y7aURgmdjTu0oDsPXchNY06/+YdOR3e6BCtrJL4LM9QzTi7jLD+bJmc LFRWXvvFy79qPWc+AVqwnGnZ4obdDhWcCj7O2m1ZprHEsHF0HPl3OQzHJIlO3EqcxmQsc58Lw 7W/funJ/eba8OeE7/VmeQkL1zACvcHKaYOpDFYlAERXNIWbkKckWSSqu51eBKpdyZXp96nFs7 2N4QYXJRPYoDQ1HaQbXhGt+RCe5d20iOlLMUBi1zh/ARYbLgXXFP+ACsYs3LjXhRBAzNFrOTu 8T7h/Omtfa4h6tBd/Ub05R7zVqK698fAaA6JMeaoeybVYs67wXMtCJsZ3qPOAVb1WwMkcnVOe /V2PKMMuwedAcQuSfu+dhKFuf8eLvvU5btt+OMz8CZseoeme88jKGs+KMp40suuukGFiYYh3u y9mZQYQPFo4iAz7ImvtH4jlFj3hB3GYK2qR4NVYIoSATiugFtXXlBzV+jGcsM90ZsN8VuyhB+ NxABjrbY3Tk9ArDRZ7zkkrf90t5XzpbSWVJ/pN2X0D44uF1dPPcK1sATgqejVP2cSICtR7Dlo jlUCmZMkiexuER6pCwvSra3k6HLiNpYgA9cp6t9nkf/LZz7BWrxCfwrqdkvCvsp39IT9G4wDr QqafgUx/99r+n0B6w/jex3jnOE1rjsiA2WOykilGJRqxUMeLyLrUCls2VrU+Rv5Vyq5Ej8jbe AfyFvlaIdwy/BDPq1AfKGyARzCOby8Q+V4odyRzA9yo4XdJlU5zF+oxQQgEHSjC6gcIRf+k+P 4KSqwg+ArfNWSqU+HXfmqsEKfib5GOzw+J+ahWacORYCsc2O4XHHQnku4KhMGDkVaNN+aQmUh llOrrBH0YkIwL7TZV Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove the local variable "array" and all the memcpy function calls because this copy operation from different arrays to this variable is unnecessary. The vnt_control_out function already does a kmemdup copy of its const char *buffer argument and this was made unnecessary by: commit 12ecd24ef932 ("staging: vt6656: use off stack for out buffer USB transfers.") Author: Malcolm Priestley Date: Sat Apr 22 11:14:57 2017 +0100 staging: vt6656: use off stack for out buffer USB transfers. Since 4.9 mandated USB buffers be heap allocated this causes the drive= r to fail. Since there is a wide range of buffer sizes use kmemdup to create allocated buffer. So, the same result can be achieved using the arrays directly. Signed-off-by: Oscar Carter =2D-- drivers/staging/vt6656/rf.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c index 06fa8867cfa3..82d3b6081b5b 100644 =2D-- a/drivers/staging/vt6656/rf.c +++ b/drivers/staging/vt6656/rf.c @@ -770,7 +770,6 @@ int vnt_rf_table_download(struct vnt_private *priv) u16 length1 =3D 0, length2 =3D 0, length3 =3D 0; u8 *addr1 =3D NULL, *addr2 =3D NULL, *addr3 =3D NULL; u16 length, value; - u8 array[256]; switch (priv->rf_type) { case RF_AL2230: @@ -817,10 +816,8 @@ int vnt_rf_table_download(struct vnt_private *priv) } /* Init Table */ - memcpy(array, addr1, length1); - ret =3D vnt_control_out(priv, MESSAGE_TYPE_WRITE, 0, - MESSAGE_REQUEST_RF_INIT, length1, array); + MESSAGE_REQUEST_RF_INIT, length1, addr1); if (ret) goto end; @@ -832,10 +829,8 @@ int vnt_rf_table_download(struct vnt_private *priv) else length =3D length2; - memcpy(array, addr2, length); - ret =3D vnt_control_out(priv, MESSAGE_TYPE_WRITE, value, - MESSAGE_REQUEST_RF_CH0, length, array); + MESSAGE_REQUEST_RF_CH0, length, addr2); if (ret) goto end; @@ -852,10 +847,8 @@ int vnt_rf_table_download(struct vnt_private *priv) else length =3D length3; - memcpy(array, addr3, length); - ret =3D vnt_control_out(priv, MESSAGE_TYPE_WRITE, value, - MESSAGE_REQUEST_RF_CH1, length, array); + MESSAGE_REQUEST_RF_CH1, length, addr3); if (ret) goto end; @@ -870,11 +863,9 @@ int vnt_rf_table_download(struct vnt_private *priv) addr1 =3D &al7230_init_table_amode[0][0]; addr2 =3D &al7230_channel_table2[0][0]; - memcpy(array, addr1, length1); - /* Init Table 2 */ ret =3D vnt_control_out(priv, MESSAGE_TYPE_WRITE, 0, - MESSAGE_REQUEST_RF_INIT2, length1, array); + MESSAGE_REQUEST_RF_INIT2, length1, addr1); if (ret) goto end; @@ -886,11 +877,9 @@ int vnt_rf_table_download(struct vnt_private *priv) else length =3D length2; - memcpy(array, addr2, length); - ret =3D vnt_control_out(priv, MESSAGE_TYPE_WRITE, value, MESSAGE_REQUEST_RF_CH2, length, - array); + addr2); if (ret) goto end; =2D- 2.20.1