Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2893563pxu; Sun, 29 Nov 2020 08:11:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJwLYrqF/gtIgq20gNtXsI4zsJE/0ScPBhryUMFpWD7ahG7X0Fgro8Qtisuf8lyuG8TrppUg X-Received: by 2002:a05:6402:104d:: with SMTP id e13mr17389308edu.179.1606666263244; Sun, 29 Nov 2020 08:11:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606666263; cv=none; d=google.com; s=arc-20160816; b=k9OvHuCnnT31hOzPK6ZKDqYc3xq5iVSLfgLlN3QBfEbCgGwyzUnc4ftop2OHr4GVH8 WjGRVfmu5QdnBuRkz+57pap4uQKejOxSlHoa+GQDC0eiRmjMIVDlRD90a1QaXQNdFBCx 2A86sXkyE0rLj5w4viRcPw8FCLBUNpbJY02SY2T0AM2LPYBy4UVd355NWZzywKyHJDNV hvTQ45G8jKaZ4Uvcb9wtmv0Wv58QzikjifjddXJAgzmyO+ozTFF6mpqyavWCrgAi6CSc KM3H8f3W9ylzy+egcQmxE1z3pgRpI2W2pWS3uwWWCMOLD+JKpD0Fa+IHC5m0eVbEma8B oTZw== 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=LVhruWIY/P2/Y+4I2ixxsPAsvIG1kQjrmNo/r2JNhsk=; b=Lm/xAnrl1vq614apUJNV9dIiGF05FZ1ZLsawSt7U+9+PnwXG3Pbzz5ti9Y1TtsXPeg +vRc5h7QS0toely+i0orHfVQCzZPsN16mUmj75J7Ydy+5Jr9XOX842QSUquVC5PXWKL7 HAfJE5coluwqpDO10KUdizqKHdP+arKK5r9NYqSTAznVA7yCyZmOVVMTr+04m6RUFKTm GLFCHFR4kACHIOMrsCn0AQALX/OEeLLSE+2g7RuK6f3BXABAf453If/FB8q/nJ/8M6LG i0fgfYcbkjL6tmHjH1uBm/1/dRBj1gTWbM17ifgnNO8G1o8UAiP+Ea7rzwiruWZ68VbW DREQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MsjsA7nr; 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 op24si9166007ejb.355.2020.11.29.08.10.40; Sun, 29 Nov 2020 08:11:03 -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=MsjsA7nr; 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 S1728188AbgK2QHy (ORCPT + 99 others); Sun, 29 Nov 2020 11:07:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726669AbgK2QHx (ORCPT ); Sun, 29 Nov 2020 11:07:53 -0500 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D65BC061A47; Sun, 29 Nov 2020 08:06:59 -0800 (PST) Received: by mail-pf1-x442.google.com with SMTP id 131so8706728pfb.9; Sun, 29 Nov 2020 08:06:59 -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=LVhruWIY/P2/Y+4I2ixxsPAsvIG1kQjrmNo/r2JNhsk=; b=MsjsA7nr0iuTWYGF0aBVjMK0svUlyAox0Z2XKhCOUkszW/4DkkpS2UwWPXlJ212cmD iF2FKJzqqm36BbOFzk9ZQU6f77afKYYe5fvrS16UM+NqU863W9lswrnkAoKjaxhn25K6 2evXWmOkLO8gF2ivRWPDLJcpJvy5jKGNTOCFmeIWz8hNZenmxLByRBvPo9x1v0HoSjUv ozVLiJNTCHrmONpu3SnTlgPfvKW1NQEPsx91kW8Cpb6ESQxcEMSh2cG1Go4pi8RNGND2 GBHC1Pf4OIccBCKCiMIRgwCSPZJ3dS3I53mvLHUfmVGUG/aTn4VWYEuYfd09LBQBnel7 Fj4Q== 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=LVhruWIY/P2/Y+4I2ixxsPAsvIG1kQjrmNo/r2JNhsk=; b=Hor2Z629FiT+3pheiFsMIgtenrGaHZ6oBhXcMlBdX+YmM0Bh6KyuPy0xenvAyS2XOl 3osCK5y8u1rfX0Y7RNOvUMaM/HiTEEfytPjmLEnB1rPw2TzjN6jF36W6QZrRNsXQucdN IfmUeY4W+3EzGTDR6ezRqkBqcqYoUl7LQpxNG6T6MEjJfVEKb6DUd4oFtoxsRVZAWj7u qVtE8F3i6qb1+Q7LcrJ8wGH5E+zdZr960gji5focaHpMXlVR8NggKwgQDdpB9qH0+vkW AT9y7cy7rxIRMnKpxhGyvJp46Lv0olhBYQnTzJCtUTXsdJq31iBn2e7UIge9mCJ+zdka plWQ== X-Gm-Message-State: AOAM532bcQcSeBZWfpO7lDj7Jv6WpTuCf81hrtqMFNfhmzLFsVU2JYL5 lFMp5v/lQA1jJQalLCp1OZa+0hn8btj6RxfOOes= X-Received: by 2002:a17:90a:aa0e:: with SMTP id k14mr22086638pjq.153.1606666018593; Sun, 29 Nov 2020 08:06:58 -0800 (PST) Received: from localhost.localdomain ([49.207.196.188]) by smtp.gmail.com with ESMTPSA id u3sm13496837pfu.47.2020.11.29.08.06.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2020 08:06:57 -0800 (PST) From: Anant Thazhemadam To: Greg Kroah-Hartman , Anant Thazhemadam Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 05/15] usb: misc: emi26: update to use usb_control_msg_send() Date: Sun, 29 Nov 2020 21:36:02 +0530 Message-Id: <20201129160612.1908074-6-anant.thazhemadam@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201129160612.1908074-1-anant.thazhemadam@gmail.com> References: <20201129160612.1908074-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/emi26.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/usb/misc/emi26.c b/drivers/usb/misc/emi26.c index 24d841850e05..1093809d34ad 100644 --- a/drivers/usb/misc/emi26.c +++ b/drivers/usb/misc/emi26.c @@ -39,18 +39,8 @@ static int emi26_writememory (struct usb_device *dev, int address, const unsigned char *data, int length, __u8 request) { - int result; - unsigned char *buffer = kmemdup(data, length, GFP_KERNEL); - - if (!buffer) { - dev_err(&dev->dev, "kmalloc(%d) failed.\n", length); - return -ENOMEM; - } - /* Note: usb_control_msg returns negative value on error or length of the - * data that was written! */ - result = usb_control_msg (dev, usb_sndctrlpipe(dev, 0), request, 0x40, address, 0, buffer, length, 300); - kfree (buffer); - return result; + return usb_control_msg_send(dev, 0, request, 0x40, address, 0, + data, length, 300, GFP_KERNEL); } /* thanks to drivers/usb/serial/keyspan_pda.c code */ -- 2.25.1