Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1806594pxf; Fri, 26 Mar 2021 15:38:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyT0Q5RwDK2sSBST6wQo9TKacZUKf7pyiDyKRML2cpr1tTYQbq+tD803NQG/ScrM1QKeu5H X-Received: by 2002:a05:6402:17af:: with SMTP id j15mr17708309edy.50.1616798282744; Fri, 26 Mar 2021 15:38:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616798282; cv=none; d=google.com; s=arc-20160816; b=Wmxk6W2Fh3IK7DV/Z5JY7jELOIUu6OoiuKwuqKZ2tWt09mc7TWj9UleWOy9c8ZYyzg KgBswMUdsVcuzO6DNLL9tILfkBbUSyo7F74PAVX8ASXIeC5qKhFsSDgAmDY5AGUdhInQ 4Ejd3MASz3IThTDpGcC68a3g0OL9zh33M6gauwF+8LZqvJw6G3TR80+aNOeF1lF3N8aH ImHxUVsADDGvT+ATKFJLxo2MWUCXDpJmvx8KCZRnn9jW9s9nf2gGP6qnTvvejOAaTRxa HSHuKUSlwHP4Ddw7jhyPe2llOwEKFbxCnHhc3KzaC7V8alDvmy6qgR/q+aDKo+zD6JdI J+aw== 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=WKzFQKlrYE7WDOm7fsBHNHjTK+tvjtUZfYxbxTBy7Ls=; b=qaPyOmxfpXibfTe0yQwpUalNTXAdqm+uJUAPfR3XDBPZ+2c2lp3KXGIhpjBWLOeYdY HnJmWKBMya23maFqVA4DDuY8q6DnNbJGq+eJYaXNxTtypEXl9qW2dq5pwtqehjWUJ07j Oo5DDokzNp53C2pMNBVJhrXFgbmf9y7zr7qWIG9tt5E0dhDaxGoVjb1I05x63viyyfnM yyvStcaAZPR/q/bffqlp0I+IvGYgBRr0LfqPjmJ364KWfbiMAelP+AnAX+WdGRNjTzHS 5x2mQYpXYPPIWPB+CzCaTQYkpm3nOR1CLj+q/9Tc/bUWVDVZfX6izyHV7eGsor10TCmH PvQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=n9QMapMo; 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 hc43si9387468ejc.387.2021.03.26.15.37.40; Fri, 26 Mar 2021 15:38:02 -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=@gmail.com header.s=20161025 header.b=n9QMapMo; 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 S230478AbhCZWei (ORCPT + 99 others); Fri, 26 Mar 2021 18:34:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230134AbhCZWeS (ORCPT ); Fri, 26 Mar 2021 18:34:18 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B14ABC0613AA; Fri, 26 Mar 2021 15:34:18 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id t18so3234977pjs.3; Fri, 26 Mar 2021 15:34:18 -0700 (PDT) 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=WKzFQKlrYE7WDOm7fsBHNHjTK+tvjtUZfYxbxTBy7Ls=; b=n9QMapMo6dKf+eZvsPGdvLJg9O+IHws/kBQO2GR87tPbzlBCGzUHUZweIpeSUgZDSv 0Ko7pn7XU6GF3oSjUqERsVlK13rrVq5BAX6R6NYB8N0cqNydz4Kvbu7nErIC1FAWI12E TReyepi144I977t9FwaHUQfSCS/gVE05VqVBFnNx37nBtSksbVRSa9ApEVDIHgmwIub0 4ZsM8CtjEw0azrslpzjhTNlT+lvMRE8hOLW5BhFcx0cHp9AIiphi6gnSmXsK9G1JOXGZ RLayS9DL76deKq2Vdl/aHPSTysbtsyrRrK0EyBCiM7ob1wswv1X7dqxSRnENyWbLtVKO XYlw== 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=WKzFQKlrYE7WDOm7fsBHNHjTK+tvjtUZfYxbxTBy7Ls=; b=j+AdwmikfDh024gE6A18Nr7VV59K9u00DknYAIllvWIG7rrYn8mpCJ+5lc8FOhzNor 5jRInXx3XBUYxkts23+SfWYlwsN+dv3Gw3LH+9mHPXgE2XyqQkR0SsdQ00lu3Q+YIG1g SKOCXN7UIagz+KZJOqjdKMxDnfRBjGYFbkOtSN6xvGjycwjJQFD77HU/1Wx5Cz4fKEOL wF8NUCV6oCZ3+94xQqcu33cJW/rkSkDcXHGfXJg7NuEFcJ1v1nKRsmSzum00k41sPqPm dntQ4XVSrCZ2mbvqfl/Kzh9x2sjhTvF5PwmYeMAFrklOf1gE2nkpoREjy2R2jXxdI5MX ZcMA== X-Gm-Message-State: AOAM533SY6Dxl4MmIdkLoKFv7lMUkfYy5EFHoaI6ot/z9JzyIxIgGdN7 MlmDg56K1RUN6FNjtjH80Fc= X-Received: by 2002:a17:902:a406:b029:e6:78c4:71c8 with SMTP id p6-20020a170902a406b02900e678c471c8mr16962733plq.17.1616798058096; Fri, 26 Mar 2021 15:34:18 -0700 (PDT) Received: from localhost.localdomain ([49.207.194.205]) by smtp.gmail.com with ESMTPSA id c193sm10136262pfc.180.2021.03.26.15.34.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Mar 2021 15:34:17 -0700 (PDT) From: Anant Thazhemadam To: Greg Kroah-Hartman , Anant Thazhemadam , Johan Hovold Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 2/3] usb: misc: ezusb: update to use usb_control_msg_send() Date: Sat, 27 Mar 2021 04:02:50 +0530 Message-Id: <20210326223251.753952-3-anant.thazhemadam@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210326223251.753952-1-anant.thazhemadam@gmail.com> References: <20210326223251.753952-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 ensures that a short read 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 Reviewed-by: Johan Hovold --- 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