Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp939482ybz; Sat, 25 Apr 2020 07:33:57 -0700 (PDT) X-Google-Smtp-Source: APiQypJoV4zWXe8kQwQuKtbf5sPurSZvRmoqCrCYeymW5D3m30WgYmFcpwOxqBWiqSTZMYaTGk7N X-Received: by 2002:aa7:d5d5:: with SMTP id d21mr12258786eds.160.1587825237740; Sat, 25 Apr 2020 07:33:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587825237; cv=none; d=google.com; s=arc-20160816; b=W04K+mFlrXc82bVHiPLWvw/C+4BwkBwqL4Bu7XlnIVmI/9yS2QxwVOhjwA624Pb5dE cH8qRqXkr2FJVIfE9Rw0tFOtpbXyzZxXX8CBQ2abF5iVqBwHnJn2xZBC0PeN5IlqxOlt uzPPcBzGkG00qmt1HyC1qs02EYG9SOIfqFlpbU/eG56LRCKrXPQFgZF99BMCFx0FZDTA 38pJVxn4WhQm1ZmYUyNbWqMCRAYMN89dbAMgDiL794dthertp0R3Y5lGZSMVW2lNmKDF K2ngwOv5OpLPe3Xk/foGWxB1H36wTI1d2GNi7Ba0CSfEr/p+Y+3OJu7tkTPe6egG3OFQ XAZA== 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:user-agent :in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:dkim-signature; bh=Q4GOU+bHNRwObsp2e4Z8lUO3/1Ftox7YHoHFpqunK6A=; b=dUkz3QoRQ0hLr+PYKnNnLtTi917zdY3jyynBw02Q6JsopmlNeOpNKFWbs62dmD+I0/ qApN3DJiONKB7WfFYi5ORgVKWXZbzpABfJ9MUP0gWhNp50QQ9T0BuXJZ5tX6kz3p1a85 yjVhcTliNMMeFByF55W+p/UZejXkjm382UkPfsxMFf2BaZ+QRGsnKyXQgN24fVKFX4x6 L54upcS2lyMxcX410/d3VdjIsGnoOZpvNQKLH8sPU/olhQsguqrQ3nX0TVaVxE6gKhQh I4kUEf/wv3IyaGqo5/xuP6lE5lbTSVIUjxTEWEzJEdREwGaaTd7z+iCqYw4D6chGErj2 cNPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=Fi9bV+b3; 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 l2si5062966ejz.185.2020.04.25.07.33.35; Sat, 25 Apr 2020 07:33:57 -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=Fi9bV+b3; 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 S1726116AbgDYO3w (ORCPT + 99 others); Sat, 25 Apr 2020 10:29:52 -0400 Received: from mout.gmx.net ([212.227.15.19]:46591 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726062AbgDYO3w (ORCPT ); Sat, 25 Apr 2020 10:29:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1587824984; bh=6kuT8funJ3vqa7lB03kjENvAIUSytBd9cIbMLtianfQ=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:References:In-Reply-To; b=Fi9bV+b3qyIuw0/JEzOwnn32osfHPqJrjl3ti1/5LeA0G9SIcvpJLAl9KedEu+kjD lyGIeCdIEjIF27FzPQaNezjYa3w1/ZrYrzdjaebQbmL5yrIvGABRTLc6HTABZkvKXj 79EOM0rDxzGPgtza20/PRZ3zK/El+FQeBOIF/wf8= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from ubuntu ([83.52.229.196]) by mail.gmx.com (mrgmx005 [212.227.17.184]) with ESMTPSA (Nemesis) id 1My32L-1jH9wl1qCl-00zVpa; Sat, 25 Apr 2020 16:29:44 +0200 Date: Sat, 25 Apr 2020 16:29:40 +0200 From: Oscar Carter To: Joe Perches Cc: Oscar Carter , Forest Bond , Greg Kroah-Hartman , Malcolm Priestley , Quentin Deslandes , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] staging: vt6656: Remove the local variable "array" Message-ID: <20200425142940.GC3213@ubuntu> References: <20200425123844.7959-1-oscar.carter@gmx.com> <20200425123844.7959-2-oscar.carter@gmx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Provags-ID: V03:K1:dkB5rjutDIQD/CvHWNEBYuuKTh5MiG8745iheIG8SFk2KhEMvhm YovWfcFPvhZcZAQDG+JNy1VCiK38fD89uEgoaw6L0UM3m69LqBOq8nkfghHpDp81KGHT1FG DwcXGvd98tVxHND51M0F47lgodRav4uSYdVOh2pGf3nHCx+2WvveP+6DBVZYHKY4GiYGZUn iV3tprCvxBd8vg+OH30VQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:HeTqSwBaFPI=:5PCsWShHQRycQp2zGAqd1J 9BLyVoi0sh/bmNzmBKr1wQYb5UoBltipZkdPcwRTluamI6DpNXZovyiAiE551thuDK3uhHc64 4Thoyoi8hyYHkynHUzHukRotM9us9tMyC3cF7PMkfO0p3UAnmLArwRKbAVAL7ZmvjWbo4QRIf SteMrdr6JOkRa627FTw9Q4UYJ+ge4cbbXLfLWU4FySdLcBokggf1tRbUChNwT/L5D5V7kBpZB FhJbeAWLeoLlYpKZ58PpHzn5QB/laDhCEkWSZh+KvqDwhSZV5v4muMJJHsRpFJXaGdHnc6x5Z 4v3zhxegsBMw7mIMqJIHRM9HRp0zCdd0cbQSB40H7icUHM9CWEYNKoTS0NopSkt21ly0lrV9b Yd2og9nTkXuRM9phmJ0D2+X0eZmnz9f9etefWrtHFudzRD8yRMzjrOqiBIeotrllw/UQ2cbvQ gGd5EEMHL+yRLVomkMoE8C4ww+M8QcmxPnQaM7xs8aac7hqIvTpRm0ChtigMMEHsEZlcnS+dA /j1jx0KDRqXvTMzPoPV1IYlJJnlzTGInCIkrmAnRQ/vwnxvFKZozMDZTz++YyLfg8mgV0JlGR DytqJn4WUT0+sJkV0n8tgvgSixaTJgtsqi5jF8XSWtp6DC1wuGU2IHNf5Z+UC3cWNu+nJfACQ dZ2NLorCCRHOkZVVwKpa8wWldS7pdP+ZX7veJ9dLi3TSkUwTWzrhua0+tc3LvHzDzOwF4no3i TIP9sFDVF71MU8HUi6RhstbjIYyChWB0PmEBj7qgYU7B/wjxJuK3/97cCeiHdOEfxDncUMJ6Q fDL8F+0tFamuxijlWHVJ5E9mMGo4tfbwxLTv62MWTmYJoSl4KrlTqc0o2p5cfkh7F16FfA/7D SqLsroC7K9WmIlaF+boF2gBYhtZzKELENSPL9PvtMufbcqky76tQkPQaTNqvFuwgcWfhceLe9 k0nclayxVbrtfri8m87z/lpq/mp2xFPUWAvtmCq6z8c4xi6pnI3PVnMNfMN/C0J2GhcMMZYyB Z/O187zQtitIvwY7kMVHUafAVYe5CbsJEndfoCLqDFnRMKR+rQVeHYxtQktQMpHd4o9KYkFWf ilVTP1uG13lHu326DnjwmgUgrJxg5QSZYtFYZtCWLMK4GHxMsvhWSjcNY1q6DrCaVwM9LAzXu LvP9ZjYZMThxjlHT+Q9yOWQpqVab4vj7EdIaeiif3ope9d9Gw6yyOba3uMyS6LQyeqLxCSiuQ t+cz6NlTjPFEPKU3n Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 25, 2020 at 05:50:39AM -0700, Joe Perches wrote: > On Sat, 2020-04-25 at 14:38 +0200, Oscar Carter wrote: > > Remove the local variable "array" and all the memcpy function calls > > because this copy operation from different arrays to this variable is > > unnecessary. > > You might write here that vnt_control_out already does > a kmemdup copy of its const char *buffer argument and > this was made unnecessary by: > > commit 12ecd24ef93277e4e5feaf27b0b18f2d3828bc5e > 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 dri= ver > to fail. > > Since there is a wide range of buffer sizes use kmemdup to create > allocated buffer. > Great. I will add all this information to clarify the commit changelog. > > > The same result can be achieved using the arrays directly. > > > > Signed-off-by: Oscar Carter > > --- > > 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 > > --- 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 *pri= v) > > } > > > > /* 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 *pri= v) > > 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 *pri= v) > > 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 *pri= v) > > 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 *pri= v) > > 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; > > > > -- > > 2.20.1 > > > thanks, oscar carter