From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10115C433F5 for ; Fri, 17 Sep 2021 15:19:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E5E9860FA0 for ; Fri, 17 Sep 2021 15:19:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344658AbhIQPUx (ORCPT ); Fri, 17 Sep 2021 11:20:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:34102 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344232AbhIQPSt (ORCPT ); Fri, 17 Sep 2021 11:18:49 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CE50960FA0; Fri, 17 Sep 2021 15:17:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631891846; bh=Rha9qS4P7Kw5BUuskxJB40BT1KDucDflV8GV6p8ZoCE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rLFUy0UpeWKyQu2h/M0Jp4yGKHnVhKUMAhhWTLgG6N2Jx6eQj3B1ZMY0/dFCeaLh+ 1FtGoWXbN1NextHd1sGDFPS1WZjhUYq/5tSAAYdq6roqDgipLbP0PTwgEt609XOSzf cngHqTBB5iGNJ8Uy2osiAwZFjKj3faSQ4Aeilk/I= Date: Fri, 17 Sep 2021 17:17:23 +0200 From: 'Greg Kroah-Hartman' To: David Laight Cc: "Fabio M. De Francesco" , Larry Finger , Phillip Potter , Pavel Skripkin , "linux-staging@lists.linux.dev" , "linux-kernel@vger.kernel.org" , Dan Carpenter Subject: Re: [PATCH v7 17/19] staging: r8188eu: shorten calls chain of rtw_read{8,16,32}() Message-ID: References: <20210917071837.10926-1-fmdefrancesco@gmail.com> <20210917071837.10926-18-fmdefrancesco@gmail.com> <0331c99f809449e88e5e5be9311aa5a9@AcuMS.aculab.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0331c99f809449e88e5e5be9311aa5a9@AcuMS.aculab.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 17, 2021 at 03:01:27PM +0000, David Laight wrote: > From: Greg Kroah-Hartman > > Sent: 17 September 2021 15:50 > ... > > > +static int usb_read(struct intf_hdl *intfhdl, u16 addr, void *data, u8 size) > > > +{ > > > + struct adapter *adapt = intfhdl->padapter; > > > + struct dvobj_priv *dvobjpriv = adapter_to_dvobj(adapt); > > > + struct usb_device *udev = dvobjpriv->pusbdev; > > > + int status; > > > + u8 *io_buf; /* Pointer to I/O buffer */ > > > > As you "know" size is not going to be larger than 4 (hint, you should > > prboably check it), just use bytes off of the stack here, and you can > > ignore this buffer entirely. That will hopefully allow you in the > > future to get rid of that buffer as odds are it will not be needed > > anymore. > > Isn't that likely to be the buffer that gets dma'd to/from? > In which case it can't be on-stack. > Certainly that is a common problem with usb drivers. Yes it was a problem, which is why the USB core function called here does not require that and makes sure to allocate the buffer itself so that all will be fine. > Give the size of the urb? structure allocated for each transfer > adding a bounce buffer area in it for short transfers would > surely be sane. USB speeds are slow you will never notice the difference for control messages. thanks, greg k-h