Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1056373iob; Fri, 13 May 2022 21:23:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDO1UY7XsnzA1Rf6s4q1HCP8B/mr8cmUr2kkf9Te3ffDgap1eHkru2MC+eQUuVdDFZmyT2 X-Received: by 2002:a05:600c:35cc:b0:394:7e9e:bd1f with SMTP id r12-20020a05600c35cc00b003947e9ebd1fmr18088876wmq.95.1652502214815; Fri, 13 May 2022 21:23:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652502214; cv=none; d=google.com; s=arc-20160816; b=CvKjpWnbod0EFTI++AhpCBwnOCa+giGgts5Gb8APezvbYrHG4zeFvpJxgbjX1m4bH/ QhjRAGhICkv6rarWGY4xjQA5TKIli7NsHspIfYBia1eC4zg5Z0qBERqb6ll2fwgME22U UIQfvNhgzqxMsh0/S5EeHBA5+BLoi7orlCtw1Y3H5l6LCYw2ifg4K6iD6q/4mUml/QL5 ecLF1iWfCHH1ZNh5TDQ+KRwa6h30qq9DksdayCKLDmYhvAFQfVB/IQvav/YmZg8mYHzF XQVEP/q+vKwOZ5zluOGcQYuIW4CasJOlk1kupsw4CTLBZ7ursKyDMsrQd9ObjTMhpWRE s8fQ== 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:to:from; bh=qygpZexrQgc+ViRbOk9w0i68tm/GN0zWWWJQ+P5xTig=; b=ALWoYl8JMQTzzNzN+q2H3evsMRIlte2Pl7+eoqqAnOVz9n7la+VNkIoI9w8qoNzf2H yXFgVWtlssEYba6Jsni0NnrMCncWseD2zkI6GnwTdSypDfCZ/9vgaG9P2VJcsHS8VqdP iayVylrp1kC/DPi+byRly/MCukiDHcH6bELwWh8HBXdm+s9/uXjS+xpsRdU005Saz+L2 TbadUDFVRnVt1Q+HqvP+mmXNUVd6pFW7hUlMXC9DFCEjgazcAm466Fv9J8c8XAekvXcm TQdv2YtxYjqD7Y591lvyAWD5/cOwTyDWFxFkSkBIgdGWyeOc+Admcw1ySepZAXD+IDwU qp5g== 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:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i9-20020a0560001ac900b0020784366e5bsi3729216wry.708.2022.05.13.21.23.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 21:23:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 66B1135071D; Fri, 13 May 2022 17:58:35 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377708AbiEMHME (ORCPT + 99 others); Fri, 13 May 2022 03:12:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377700AbiEMHL4 (ORCPT ); Fri, 13 May 2022 03:11:56 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAE293A199; Fri, 13 May 2022 00:11:51 -0700 (PDT) Received: from canpemm500006.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4L00Ct4pc9z1JBmB; Fri, 13 May 2022 15:10:34 +0800 (CST) Received: from container.huawei.com (10.175.104.82) by canpemm500006.china.huawei.com (7.192.105.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 13 May 2022 15:11:48 +0800 From: Ziyang Xuan To: , , , , , , , Subject: [PATCH net-next] octeon_ep: delete unnecessary NULL check Date: Fri, 13 May 2022 15:29:28 +0800 Message-ID: <20220513072928.3713739-1-william.xuanziyang@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.104.82] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500006.china.huawei.com (7.192.105.130) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 vfree(NULL) is safe. NULL check before vfree() is not needed. Delete them to simplify the code. Signed-off-by: Ziyang Xuan --- drivers/net/ethernet/marvell/octeon_ep/octep_main.c | 3 +-- drivers/net/ethernet/marvell/octeon_ep/octep_rx.c | 3 +-- drivers/net/ethernet/marvell/octeon_ep/octep_tx.c | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c index e020c81f3455..7e590c572d58 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c @@ -980,8 +980,7 @@ static void octep_device_cleanup(struct octep_device *oct) dev_info(&oct->pdev->dev, "Cleaning up Octeon Device ...\n"); for (i = 0; i < OCTEP_MAX_VF; i++) { - if (oct->mbox[i]) - vfree(oct->mbox[i]); + vfree(oct->mbox[i]); oct->mbox[i] = NULL; } diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_rx.c b/drivers/net/ethernet/marvell/octeon_ep/octep_rx.c index 945947ec7723..d9ae0937d17a 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_rx.c +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_rx.c @@ -230,8 +230,7 @@ static int octep_free_oq(struct octep_oq *oq) octep_oq_free_ring_buffers(oq); - if (oq->buff_info) - vfree(oq->buff_info); + vfree(oq->buff_info); if (oq->desc_ring) dma_free_coherent(oq->dev, diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_tx.c b/drivers/net/ethernet/marvell/octeon_ep/octep_tx.c index 511552bc3e87..5a520d37bea0 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_tx.c +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_tx.c @@ -270,8 +270,7 @@ static void octep_free_iq(struct octep_iq *iq) desc_ring_size = OCTEP_IQ_DESC_SIZE * CFG_GET_IQ_NUM_DESC(oct->conf); - if (iq->buff_info) - vfree(iq->buff_info); + vfree(iq->buff_info); if (iq->desc_ring) dma_free_coherent(iq->dev, desc_ring_size, -- 2.25.1