Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5224747imw; Wed, 20 Jul 2022 01:14:40 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s86Cx6qkbKf875cF4bbqvHwaXguVBhkTfIgcAC6kj9B2ebYZmAmZfLsNmEaCil3UEty0Ni X-Received: by 2002:a17:907:87b0:b0:72b:9f0d:3f89 with SMTP id qv48-20020a17090787b000b0072b9f0d3f89mr33018684ejc.734.1658304880130; Wed, 20 Jul 2022 01:14:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658304880; cv=none; d=google.com; s=arc-20160816; b=Dwu0R5FYXOu8JX0yHRErbAARibKfWCU3I7EINRJyhjtOxJmRwNDhP1IBqfHxCAl/5i V3PNGvyaKa8NBOFgMPy43jKTRFuAjThdlsrIDhWtWL8oaNZBnWM88JCAPKQiyo3fmsJf ykjd7RoKy8cTSdbfBFvdlrA0ee40u1g2buVCrJvQLR/QMJpOHuN0hEJwQMfCNWtj2ANL Xdq9WokzbO4HsVmLXuG5j01DkapJGp+yn4MbODKrueOlhBxldkDgxWXc1NhG20+3Fx9w jF6bg3qcxSXdnzOzpOUT45FutTS38ZFYpL0N+Gf+XvuqQOkUp8jI/1QF8556G1Df5r3E Ahww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=bcaVL+SLqc/Cqe7nUeK3U3juDatqRwSuexDVayoISt8=; b=vlTDtOXwdb/XwuZuR0c80Dc9d0eCrcykRH2dKrXEtMFZVLjjvREslvslgHlmDhg4N5 Ly1vNaROcS42dD4Oo2mc77XWcngvO/2ok+0PtF+R6fuC14IhastZO3mS4djwlW/75q0u Cr3Is99tNFSGJIP3FiVS2HUJ+3jA4PICXMaIj9AM9rGmYLvExGZ++Rpmiw8Q6yRYie/1 MJl+iawsb4F37S8Zf2Hm8/gFAHKLRlIqw6V4+xqgRCDLmTYDpzA9Yil/TUYBY16NphlN i6Eu6JjANktsy/Icz9svk8uot1XLTda8FoXOgg0dTZzYxRT6sMNnhYyVqf2b77WD4SBZ KDDA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mp37-20020a1709071b2500b0072b4ad153dasi26928394ejc.635.2022.07.20.01.14.14; Wed, 20 Jul 2022 01:14:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238060AbiGTIIt (ORCPT + 99 others); Wed, 20 Jul 2022 04:08:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235321AbiGTIIs (ORCPT ); Wed, 20 Jul 2022 04:08:48 -0400 Received: from smtp.smtpout.orange.fr (smtp02.smtpout.orange.fr [80.12.242.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9495940BE8 for ; Wed, 20 Jul 2022 01:08:46 -0700 (PDT) Received: from [192.168.1.18] ([90.11.190.129]) by smtp.orange.fr with ESMTPA id E4l9oj5oSjNN8E4l9odm4p; Wed, 20 Jul 2022 10:08:44 +0200 X-ME-Helo: [192.168.1.18] X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Wed, 20 Jul 2022 10:08:44 +0200 X-ME-IP: 90.11.190.129 Message-ID: Date: Wed, 20 Jul 2022 10:08:42 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH] usb: trancevibrator: simplify tv_probe Content-Language: en-US To: dzm91@hust.edu.cn Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, mudongliangabcd@gmail.com References: <20220720072346.33511-1-dzm91@hust.edu.cn> <604f2d3f-659c-3312-d69f-c133aec275ca@wanadoo.fr> From: Christophe JAILLET In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 20/07/2022 à 09:56, Dongliang Mu a écrit : > On Wed, Jul 20, 2022 at 3:46 PM Christophe JAILLET > wrote: >> >> Le 20/07/2022 à 09:23, Dongliang Mu a écrit : >>> 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. >>> Another change is to remove a redundant space. >>> >>> Signed-off-by: Dongliang Mu >>> --- >>> drivers/usb/misc/trancevibrator.c | 13 +++---------- >>> 1 file changed, 3 insertions(+), 10 deletions(-) >>> >>> diff --git a/drivers/usb/misc/trancevibrator.c b/drivers/usb/misc/trancevibrator.c >>> index 26baba3ab7d7..30d4d774d448 100644 >>> --- a/drivers/usb/misc/trancevibrator.c >>> +++ b/drivers/usb/misc/trancevibrator.c >>> @@ -84,29 +84,22 @@ 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; >> >> Hi, >> >> looks like: >> >> error: >> kfree(dev); >> return retval; >> >> at the end of the function can be removed as-well. >> > > My patch actually removes them. Sorry for the noise. My mailer or newsgroup server sometimes plays me some tricks and only displays partial message :(. CJ > >> Just my 2c. >> >> CJ >