From patchwork Thu Aug 11 09:02:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongliang Mu X-Patchwork-Id: 12941269 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE254C25B0C for ; Thu, 11 Aug 2022 09:03:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234851AbiHKJD3 (ORCPT ); Thu, 11 Aug 2022 05:03:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234841AbiHKJD0 (ORCPT ); Thu, 11 Aug 2022 05:03:26 -0400 Received: from hust.edu.cn (unknown [202.114.0.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2A7E186CC; Thu, 11 Aug 2022 02:03:25 -0700 (PDT) Received: from localhost.localdomain ([172.16.0.254]) (user=dzm91@hust.edu.cn mech=LOGIN bits=0) by mx1.hust.edu.cn with ESMTP id 27B934X8019956-27B934XB019956 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 11 Aug 2022 17:03:10 +0800 From: Dongliang Mu To: Greg Kroah-Hartman , Dongliang Mu Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] USB: trancevibrator: remove redundant space Date: Thu, 11 Aug 2022 17:02:08 +0800 Message-Id: <20220811090213.35899-1-dzm91@hust.edu.cn> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-FEAS-AUTH-USER: dzm91@hust.edu.cn Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Dongliang Mu remove a redundant space after usb_get_intfdata Signed-off-by: Dongliang Mu --- drivers/usb/misc/trancevibrator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/misc/trancevibrator.c b/drivers/usb/misc/trancevibrator.c index 26baba3ab7d7..55cb63652eda 100644 --- a/drivers/usb/misc/trancevibrator.c +++ b/drivers/usb/misc/trancevibrator.c @@ -106,7 +106,7 @@ static void tv_disconnect(struct usb_interface *interface) { struct trancevibrator *dev; - dev = usb_get_intfdata (interface); + dev = usb_get_intfdata(interface); usb_set_intfdata(interface, NULL); usb_put_dev(dev->udev); kfree(dev); From patchwork Thu Aug 11 09:02:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongliang Mu X-Patchwork-Id: 12941268 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AAEC1C19F2A for ; Thu, 11 Aug 2022 09:03:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234846AbiHKJD2 (ORCPT ); Thu, 11 Aug 2022 05:03:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234840AbiHKJD0 (ORCPT ); Thu, 11 Aug 2022 05:03:26 -0400 Received: from hust.edu.cn (mail.hust.edu.cn [202.114.0.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C8FE167E1; Thu, 11 Aug 2022 02:03:23 -0700 (PDT) Received: from localhost.localdomain ([172.16.0.254]) (user=dzm91@hust.edu.cn mech=LOGIN bits=0) by mx1.hust.edu.cn with ESMTP id 27B934X8019956-27B934XC019956 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 11 Aug 2022 17:03:16 +0800 From: Dongliang Mu To: Greg Kroah-Hartman , Dongliang Mu Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] USB: trancevibrator: simplify tv_probe Date: Thu, 11 Aug 2022 17:02:09 +0800 Message-Id: <20220811090213.35899-2-dzm91@hust.edu.cn> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220811090213.35899-1-dzm91@hust.edu.cn> References: <20220811090213.35899-1-dzm91@hust.edu.cn> MIME-Version: 1.0 X-FEAS-AUTH-USER: dzm91@hust.edu.cn Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Dongliang Mu The function tv_probe does not need to invoke kfree when the allocation fails. So let's simplify the code of tv_probe. Signed-off-by: Dongliang Mu --- drivers/usb/misc/trancevibrator.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/usb/misc/trancevibrator.c b/drivers/usb/misc/trancevibrator.c index 55cb63652eda..30d4d774d448 100644 --- a/drivers/usb/misc/trancevibrator.c +++ b/drivers/usb/misc/trancevibrator.c @@ -84,22 +84,15 @@ static int tv_probe(struct usb_interface *interface, { struct usb_device *udev = interface_to_usbdev(interface); struct trancevibrator *dev; - int retval; dev = kzalloc(sizeof(struct trancevibrator), GFP_KERNEL); - if (!dev) { - retval = -ENOMEM; - goto error; - } + if (!dev) + return -ENOMEM; dev->udev = usb_get_dev(udev); usb_set_intfdata(interface, dev); return 0; - -error: - kfree(dev); - return retval; } static void tv_disconnect(struct usb_interface *interface)