From nobody Sun May 10 09:55:33 2026 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 78138C433EF for ; Fri, 13 May 2022 07:12:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377702AbiEMHMG (ORCPT ); Fri, 13 May 2022 03:12:06 -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: quoted-printable 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 *o= ct) dev_info(&oct->pdev->dev, "Cleaning up Octeon Device ...\n"); =20 for (i =3D 0; i < OCTEP_MAX_VF; i++) { - if (oct->mbox[i]) - vfree(oct->mbox[i]); + vfree(oct->mbox[i]); oct->mbox[i] =3D NULL; } =20 diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_rx.c b/drivers/ne= t/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) =20 octep_oq_free_ring_buffers(oq); =20 - if (oq->buff_info) - vfree(oq->buff_info); + vfree(oq->buff_info); =20 if (oq->desc_ring) dma_free_coherent(oq->dev, diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_tx.c b/drivers/ne= t/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) =20 desc_ring_size =3D OCTEP_IQ_DESC_SIZE * CFG_GET_IQ_NUM_DESC(oct->conf); =20 - if (iq->buff_info) - vfree(iq->buff_info); + vfree(iq->buff_info); =20 if (iq->desc_ring) dma_free_coherent(iq->dev, desc_ring_size, --=20 2.25.1