From patchwork Fri Aug 12 06:18:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongliang Mu X-Patchwork-Id: 12941930 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 C03AAC00140 for ; Fri, 12 Aug 2022 06:20:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236803AbiHLGU3 (ORCPT ); Fri, 12 Aug 2022 02:20:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229877AbiHLGU1 (ORCPT ); Fri, 12 Aug 2022 02:20:27 -0400 Received: from hust.edu.cn (mail.hust.edu.cn [202.114.0.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B3AF14090; Thu, 11 Aug 2022 23:20:24 -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 27C6J36d031128-27C6J36g031128 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 12 Aug 2022 14:19:08 +0800 From: Dongliang Mu To: Greg Kroah-Hartman , Dongliang Mu Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/2] USB: trancevibrator: remove redundant space Date: Fri, 12 Aug 2022 14:18:01 +0800 Message-Id: <20220812061805.88627-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 Fri Aug 12 06:18:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongliang Mu X-Patchwork-Id: 12941931 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 24150C25B0F for ; Fri, 12 Aug 2022 06:20:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236920AbiHLGUa (ORCPT ); Fri, 12 Aug 2022 02:20:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230133AbiHLGU1 (ORCPT ); Fri, 12 Aug 2022 02:20:27 -0400 Received: from hust.edu.cn (unknown [202.114.0.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C13C1409D; Thu, 11 Aug 2022 23:20: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 27C6J36d031128-27C6J36h031128 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 12 Aug 2022 14:19:12 +0800 From: Dongliang Mu To: Greg Kroah-Hartman , Dongliang Mu Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/2] USB: trancevibrator: simplify tv_probe Date: Fri, 12 Aug 2022 14:18:02 +0800 Message-Id: <20220812061805.88627-2-dzm91@hust.edu.cn> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220812061805.88627-1-dzm91@hust.edu.cn> References: <20220812061805.88627-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 --- v2->v3: fix the truncated subject of PATCH 2/2. v1->v2: no change 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)