Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6884283iob; Wed, 11 May 2022 07:22:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHDhB6Cg5D7nvvejWDR8kVp9QgTYNexqEmjuNaUptg2HbVGsHqzxEqc7R8Mc0sW3hGARPL X-Received: by 2002:a63:6aca:0:b0:3ab:a56:126a with SMTP id f193-20020a636aca000000b003ab0a56126amr20982922pgc.576.1652278965823; Wed, 11 May 2022 07:22:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652278965; cv=none; d=google.com; s=arc-20160816; b=sgG7sJtJdvKqZFyyM+piZuLJ5ITpO7RLLIUunuh1xIzpbaOEWHvYp4jGFOCj8qVG1E kXjCg38N4NK4POMt0vC9ir7L5+HdBJL6b1mHQMSIOjhgwY50qUwUVC63E78S6C0V6OnR TDT2jbjs3MlFsFyRKTczGKylXyp3Rg1woYyJ8U7WL/lhDD6xfUS7KjgHf2sIAFOe8Std ZIZSh0jKRO1ISoRjMTo15fxPr3RfXF6XlD3vqz+6/o9kVN66Pq0o2d2rOFE2kkH0wsW2 esdgkiBQ9I2scMgP4d6zCWEE7U7AY1aF+D72nOWag2jDw9OpVML+fShH594IRDS2Id6y HlTQ== 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=C7Z/rx32c/cR9tT2PP2QxCWlQz3jKgGCRgpp9g7dDHM=; b=psfkfd2XHXJEl8O4cBjxWTXYSRJR6j6qcaaBxepozrMeflPEDtY9Bkpg3IVGLErriX Iq4ehFOBl1u1pqkvP0n6XsyaG57HjPPVum36kjAycFTzJ4Ne5rZ7p/Fsdpvs1i+rgoB9 lhMNJBvdGi/WdY+qYeQRGQnKFnEs4E4vPwKwzfEVsNUJI9xO73ClI86fV7iCLo6HWicR INJJCBClVrtvgsvF1C4YCxFKV0/GPfUk4QCZbg2EkA6hW/pl5uja0DtPSWl4rhfNe5md XNhyG0YevhO2aYAOIwSOVv5d/nFsvx3ztQ3C160xDsRqsYm+ip8bVL5P13drp0lfZU9K WPYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@126.com header.s=s110527 header.b=Ze0dgM1u; 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 g14-20020a056a000b8e00b0050e0a5aa240si2972552pfj.6.2022.05.11.07.22.29; Wed, 11 May 2022 07:22:45 -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=Ze0dgM1u; 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 S229780AbiEKHZk (ORCPT + 99 others); Wed, 11 May 2022 03:25:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229561AbiEKHZh (ORCPT ); Wed, 11 May 2022 03:25:37 -0400 Received: from m15113.mail.126.com (m15113.mail.126.com [220.181.15.113]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A64821C94EC; Wed, 11 May 2022 00:25:35 -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=C7Z/r x32c/cR9tT2PP2QxCWlQz3jKgGCRgpp9g7dDHM=; b=Ze0dgM1umeB5q9cYf6OHN 7TL9RN4hFO5KAbE16H0j0NgFECHQV7O/8Cp/E2mrtu+PYBXzy7CGwrbnWDTsxG7b Bno/Bw695u+SEASpWMc3QQgyuI74xvXlTy318FuzgRbnRsKF3LXZTyOCkRWLYhyW xpQcdjW0McG+cA2TXmIG1o= Received: from ubuntu.localdomain (unknown [58.213.83.157]) by smtp3 (Coremail) with SMTP id DcmowAAHA5zaZHti+k_FBQ--.16427S4; Wed, 11 May 2022 15:25:15 +0800 (CST) From: Bernard Zhao To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Bernard Zhao , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Bernard Zhao Subject: [PATCH] ethernet/ti: delete if NULL check befort devm_kfree Date: Wed, 11 May 2022 00:25:10 -0700 Message-Id: <20220511072512.666863-1-zhaojunkui2008@126.com> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: DcmowAAHA5zaZHti+k_FBQ--.16427S4 X-Coremail-Antispam: 1Uf129KBjvJXoW7ZFW7JryDWw4DAr1kAryUtrb_yoW8AFW3pa 93GF1UtFy7Zw4fGanrZF4rX345Wa1Sk3yDCry8CryfAw4Fyw1rtF18uFWDuFy5WrWkAay5 AF4DAa4xXr1q9F7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pEt8nnUUUUU= X-Originating-IP: [58.213.83.157] X-CM-SenderInfo: p2kd0y5xqn3xasqqmqqrswhudrp/1tbiuRz9qlpD857i+QAAsd 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 devm_kfree check the point, there is no need to check before devm_kfree call. This change is to cleanup the code a bit. Signed-off-by: Bernard Zhao Signed-off-by: Bernard Zhao --- drivers/net/ethernet/ti/am65-cpsw-qos.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/ti/am65-cpsw-qos.c b/drivers/net/ethernet/ti/am65-cpsw-qos.c index ebcc6386cc34..16b8794cb13c 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-qos.c +++ b/drivers/net/ethernet/ti/am65-cpsw-qos.c @@ -164,8 +164,7 @@ static void am65_cpsw_admin_to_oper(struct net_device *ndev) { struct am65_cpsw_port *port = am65_ndev_to_port(ndev); - if (port->qos.est_oper) - devm_kfree(&ndev->dev, port->qos.est_oper); + devm_kfree(&ndev->dev, port->qos.est_oper); port->qos.est_oper = port->qos.est_admin; port->qos.est_admin = NULL; @@ -432,11 +431,8 @@ static void am65_cpsw_purge_est(struct net_device *ndev) am65_cpsw_stop_est(ndev); - if (port->qos.est_admin) - devm_kfree(&ndev->dev, port->qos.est_admin); - - if (port->qos.est_oper) - devm_kfree(&ndev->dev, port->qos.est_oper); + devm_kfree(&ndev->dev, port->qos.est_admin); + devm_kfree(&ndev->dev, port->qos.est_oper); port->qos.est_oper = NULL; port->qos.est_admin = NULL; @@ -522,8 +518,7 @@ static int am65_cpsw_set_taprio(struct net_device *ndev, void *type_data) ret = am65_cpsw_configure_taprio(ndev, est_new); if (!ret) { if (taprio->enable) { - if (port->qos.est_admin) - devm_kfree(&ndev->dev, port->qos.est_admin); + devm_kfree(&ndev->dev, port->qos.est_admin); port->qos.est_admin = est_new; } else { -- 2.33.1