Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6655502iob; Wed, 11 May 2022 02:24:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzoMaQWHRcUspjknQdo0zIGMKWkNWq+Y20UC2fgkiBLEV999i7JM4VQkY4FXFnniuFHsNDK X-Received: by 2002:a17:902:f68f:b0:15e:ca1b:c4f5 with SMTP id l15-20020a170902f68f00b0015eca1bc4f5mr23756051plg.107.1652261093874; Wed, 11 May 2022 02:24:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652261093; cv=none; d=google.com; s=arc-20160816; b=fxP49xB6g/p7SgeXgWl+EkYfZGRhCQGGyI+T9jCZqNOsNy5DEX11Rf1aYrXRnXO9h3 XWyUWRnVZ/wRa1p7AQs2yW4vsQyX5e7pW1kdLZhknw+1eWea8ktK/zMORljKSl+56EOJ VF2Xq0plrv9FxzcqffJlzlfNNgk8h7Qt217K3wX6B14P3qvQIbp5zEwNGmdE+B8zdB9w Gj2a5tjHf/Q3dzCPqsngsi048eEt7BRzAtX/9+U29xjo1S7/Gw4kaM5sFJ+wXo9PtHSV 4GjZpwOyJy12HHkKfLeWHT6ohgHAGGQ5+4Scz00rYPxWwiWSA98V5sTrT/kfH7H3elj2 0hLg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=RtS247RW6ZxcuKLxbipUrhShdpX0VWnQy9+bo9nU/z0=; b=Pyj473WH1iz9sFz7I/UODtl0SfNEmUyjtY2+DQ8RSBitHdJ/cerjZ2K8DL8175QzdP Ht/VP1uJa99S7IShR3vgFlLhQtKqMZcZPDe/EQF6ydTFY7/Lx6si8QaDpiT+842E/Y3g omLD01tZ1AhzQ8GLD0AK7QxQBXLIY6JJdXBHF37S6XLMW2qXYwge3CRXk40XldJ+is5z PdUXYK3GC5pan8kgM0bSHXcs3B55JMnYIqXdysjNgp4vS9M6W25E1aLB59mwPHtRvmDJ 4V5kFRDiDyjsaoCmBJuW/C+FbVPLwzCMeTu8f3c2M0q+Mf0B2R3SlGECnJD+4z4t7WF8 fh+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@126.com header.s=s110527 header.b=MtRl5z1q; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=126.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l2-20020a170903244200b0015ef71934fdsi2204836pls.180.2022.05.11.02.24.39; Wed, 11 May 2022 02:24:53 -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; dkim=pass header.i=@126.com header.s=s110527 header.b=MtRl5z1q; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=126.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242215AbiEKGkL (ORCPT + 99 others); Wed, 11 May 2022 02:40:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234181AbiEKGkI (ORCPT ); Wed, 11 May 2022 02:40:08 -0400 Received: from m15111.mail.126.com (m15111.mail.126.com [220.181.15.111]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7C4C42421BA; Tue, 10 May 2022 23:40:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=RtS24 7RW6ZxcuKLxbipUrhShdpX0VWnQy9+bo9nU/z0=; b=MtRl5z1q/6cIOBNpfGv+r d+HK7xlcGhnOB1NZz5JT3W5KP4euDRBauSrk4vaAOpt5albmVCDnmSajEf/SC1PR UpmtuSWazeyp5UUjAwiycAmy9zM6Jf5hicMy5+yiIv1h3XegS83EvDW951zrgfyL o7xWVdkvcAJbYDBU8hwWL8= Received: from ubuntu.localdomain (unknown [58.213.83.157]) by smtp1 (Coremail) with SMTP id C8mowAAXj9_8WXtiubKBBw--.33626S4; Wed, 11 May 2022 14:38:54 +0800 (CST) From: Bernard Zhao To: Wolfgang Grandegger , Marc Kleine-Budde , "David S. Miller" , Jakub Kicinski , Paolo Abeni , =?UTF-8?q?Stefan=20M=C3=A4tje?= , Vincent Mailhol , Bernard Zhao , linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: bernard@vivo.com Subject: [PATCH] usb/peak_usb: cleanup code Date: Tue, 10 May 2022 23:38:38 -0700 Message-Id: <20220511063850.649012-1-zhaojunkui2008@126.com> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: C8mowAAXj9_8WXtiubKBBw--.33626S4 X-Coremail-Antispam: 1Uf129KBjvdXoWrurWktF4fWF1fAryrWFyxGrg_yoWktrXEkr W7Zr4kJF1UCrWjqF4DJw4Svry2y3WkuFs7XwnrKFs3G34YyF4UXrWxCFZ3Gw43WF1ayF9I kr1UJr4xAr18tjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7sRAR6w3UUUUU== X-Originating-IP: [58.213.83.157] X-CM-SenderInfo: p2kd0y5xqn3xasqqmqqrswhudrp/1tbiuR79qlpD854fggAAsZ X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 The variable fi and bi only used in branch if (!dev->prev_siblings) , fi & bi not kmalloc in else branch, so move kfree into branch if (!dev->prev_siblings),this change is to cleanup the code a bit. Signed-off-by: Bernard Zhao --- drivers/net/can/usb/peak_usb/pcan_usb_pro.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c index ebe087f258e3..70c5aef57247 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c @@ -903,6 +903,9 @@ static int pcan_usb_pro_init(struct peak_usb_device *dev) pcan_usb_pro.name, bi->hw_rev, bi->serial_num_hi, bi->serial_num_lo, pcan_usb_pro.ctrl_count); + + kfree(bi); + kfree(fi); } else { usb_if = pcan_usb_pro_dev_if(dev->prev_siblings); } @@ -913,9 +916,6 @@ static int pcan_usb_pro_init(struct peak_usb_device *dev) /* set LED in default state (end of init phase) */ pcan_usb_pro_set_led(dev, PCAN_USBPRO_LED_DEVICE, 1); - kfree(bi); - kfree(fi); - return 0; err_out: -- 2.33.1