Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp453061pxb; Wed, 27 Jan 2021 11:48:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJzCp6GYSSvoDHBJr1GEXJsY2bdjt8ptCL42pnGxih4tRcr6qDhUEH9Gqn7eJ4n+IxvfQ934 X-Received: by 2002:a17:906:1712:: with SMTP id c18mr8190406eje.417.1611776924702; Wed, 27 Jan 2021 11:48:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611776924; cv=none; d=google.com; s=arc-20160816; b=mODxmKUxj236Wiat9qpEuMXUHwD7Lvz/r1MrjtQZuA4t0TvJYyvDkFWKClig5mBuLt TZeujUwrQj98aSPRzibpTQjaS4F1PF/8IcbqCt52TxbP9hROC7RjTpeGxlzuKnMYSEhU DrCb+IfX8olEizQifiYAqFM5G786hm7u55FJrkQwjutQ24TrHH1JBiymPtjvb3Y95yR8 LLArkrvokdx6IMDdw67WEjxnaK6hRNNriNLDLWQLXa3QH3xU4Q4ExiKrcvst1uRVYY0S 5RxL0zZnjw/ZgTPL7tr+x6ra0y8yDzEwqXoho+dRfig2RGjMTCkxNoVHBThiOcOjyhC3 IVNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Rlm5PUymFHRx39FCcGjfRRBHQ3f0wd7qTZT6jsgLwkA=; b=ukL1WMDHcVtBv+G1qp77myfwR+EkToWexlbMVwN8uQyQAQRcNDXOopHWRIu++zyjtr kz+PvqOEffvR6QYVFV/JuwwAOCnW23ZlomU+ukt9ZwjyEAOkCfWswa+90O/ig9Z09Cun xeTZTsuGJp1MKmfU5ekmvoXRzGiOvqOYHZyARBcQ2QzFXX+8nakmDdPqYVdk5ViWCm3T UpyB5VMW719pYYXk9wFY+kN3Vuxg7fxEDSiILzfr+EQSU+Q5Pq+zbfuJxXy9b1+4ZOi6 KuLtu0NGAd63DHgnrBH2Eldh5xFxRybsxWzPqTA6bmIKaSZkhaf+cQOkog6PPTjkZX7D leiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pldzPP87; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z13si1542495edp.557.2021.01.27.11.48.19; Wed, 27 Jan 2021 11:48:44 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=pldzPP87; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405010AbhA0BbF (ORCPT + 99 others); Tue, 26 Jan 2021 20:31:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394789AbhAZSgB (ORCPT ); Tue, 26 Jan 2021 13:36:01 -0500 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D827DC061786; Tue, 26 Jan 2021 10:35:20 -0800 (PST) Received: by mail-pl1-x62c.google.com with SMTP id u11so10222004plg.13; Tue, 26 Jan 2021 10:35:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Rlm5PUymFHRx39FCcGjfRRBHQ3f0wd7qTZT6jsgLwkA=; b=pldzPP87+IAjdQFo5gB4mTAxJDiykolSRf9RJD1R29q+gjloKdScXFVNudyO2fzqLd pKGc4a8CbMMLXXFffBakorBGXvFI86RZ4j54HqOtEntkoiiBUjp223sTRA+iSmxpftjA xLKf34yLq+7cgACxqGLUK7nVpQDDrtZcgzdz8ppQTvf0MLoYNkD0fbs+XTrLz9qVo9Uv 4qRfAPcsocDP0VYL6DYm6hCQRQJpXlLUOJb1Bk9mKW21y4Py/bP4/h9mJPrlQJXqurAH qBOlxTdCrH6skMWJ5s4Ix/QoYqGxilFFEXgDpfGN+vcQUZf8M/B+T0PE8QCqCkIB0p5+ 9i+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Rlm5PUymFHRx39FCcGjfRRBHQ3f0wd7qTZT6jsgLwkA=; b=d9F0KGX3HtxxiydluBJ9QGcKZa2a3ZOlng1+IFzPP3tAw//6spQAhEknBwgfzApfX/ sD/0KIVldUwq9b7T1opzraPqlhopK+LbNmEWzr6OfT1Vtxfl0Ekh1U4/ETkS+nlEg0JI nX6mhC5gaP0WqyMMaL9MoBF018/+qXoxOauBZu3cWiF2/SrNAsCOSLisx8ZArISXt4Ls zlmvF8tOTZ6yaAs5TXLyrdEEb1J+gAEU24IDdopEjzysP4VCtZqRbmC2MfWM02bmU0Dn 8bg4dJ/kWX6UgKbuHOlclYpSnJdje0QxIYt5OqGgXVBbuzzEZOXRiSmemq5upC/4KquI rlbA== X-Gm-Message-State: AOAM531YqJHyzE8f1SdbuK2LbYQs1pulML/sx9wuo4DvL7KV6waHkn44 56KC+2g0/Gv4qrJTt7xXSrE= X-Received: by 2002:a17:90b:4a4d:: with SMTP id lb13mr1164903pjb.44.1611686120413; Tue, 26 Jan 2021 10:35:20 -0800 (PST) Received: from localhost.localdomain ([49.207.195.86]) by smtp.gmail.com with ESMTPSA id y75sm472711pfg.119.2021.01.26.10.35.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jan 2021 10:35:19 -0800 (PST) From: Anant Thazhemadam To: Greg Kroah-Hartman , Anant Thazhemadam Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 05/12] usb: misc: ezusb: update to use usb_control_msg_send() Date: Wed, 27 Jan 2021 00:03:56 +0530 Message-Id: <20210126183403.911653-6-anant.thazhemadam@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210126183403.911653-1-anant.thazhemadam@gmail.com> References: <20210126183403.911653-1-anant.thazhemadam@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The newer usb_control_msg_{send|recv}() API are an improvement on the existing usb_control_msg() as it ensures that a short read/write is treated as an error, data can be used off the stack, and raw usb pipes need not be created in the calling functions. For this reason, the instance of usb_control_msg() has been replaced with usb_control_msg_send() appropriately. Signed-off-by: Anant Thazhemadam --- drivers/usb/misc/ezusb.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/drivers/usb/misc/ezusb.c b/drivers/usb/misc/ezusb.c index f058d8029761..78aaee56c2b7 100644 --- a/drivers/usb/misc/ezusb.c +++ b/drivers/usb/misc/ezusb.c @@ -31,24 +31,12 @@ static const struct ezusb_fx_type ezusb_fx1 = { static int ezusb_writememory(struct usb_device *dev, int address, unsigned char *data, int length, __u8 request) { - int result; - unsigned char *transfer_buffer; - if (!dev) return -ENODEV; - transfer_buffer = kmemdup(data, length, GFP_KERNEL); - if (!transfer_buffer) { - dev_err(&dev->dev, "%s - kmalloc(%d) failed.\n", - __func__, length); - return -ENOMEM; - } - result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), request, + return usb_control_msg_send(dev, 0, request, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - address, 0, transfer_buffer, length, 3000); - - kfree(transfer_buffer); - return result; + address, 0, data, length, 3000, GFP_KERNEL); } static int ezusb_set_reset(struct usb_device *dev, unsigned short cpucs_reg, -- 2.25.1