From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f169.google.com (mail-pd0-f169.google.com [209.85.192.169]) by dpdk.org (Postfix) with ESMTP id C27585683 for ; Tue, 7 Apr 2015 23:21:04 +0200 (CEST) Received: by pddn5 with SMTP id n5so91539351pdd.2 for ; Tue, 07 Apr 2015 14:21:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=RvHB93eeHt8b0zoB9EGmWK9JjrIoDDOA1NHikcCnWrc=; b=NbY7HEhREoZibXJGGFUgzV5O8WRSf/3+J+pbmJyL40BI/Msc/3tWka+m9FfLAF+AQ4 6w+4Q2s4e0A9G5+ZK7avfUQHv8pgYoFgh52WGsUY3IOCJVWuYVC434NWYJ5kNiQJmhOW UcgXT1iy5fl6nll11gvJEamRJUngcuRMxNoPTJNY14rPgAn4IHEG6pPGv3MMeep4MCCs QoxfWc3im/y+1+KEAwvFAbxMY6QrdX682ymNN7siQFsmr7oM+SIubUQ7ecbO+u8ZyReR AI5Tj8utuOO0cJcm4bW75XfbYVP7/rWLnVEEoDyKl9XOQYdatiobixzd4KG9MbMmGTeQ PeTQ== X-Gm-Message-State: ALoCoQnO09UgErzNZkhME8OB1umYQ8Xq9uYlRc717Bd0Lz1AXokBNtZ2pa3HOg74Rg9BGCH3RsF3 X-Received: by 10.67.22.201 with SMTP id hu9mr40030110pad.121.1428441663998; Tue, 07 Apr 2015 14:21:03 -0700 (PDT) Received: from urahara.brocade.com (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by mx.google.com with ESMTPSA id j2sm9020328pdn.44.2015.04.07.14.21.02 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 07 Apr 2015 14:21:03 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Date: Tue, 7 Apr 2015 14:21:00 -0700 Message-Id: <1428441663-3825-3-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1428441663-3825-1-git-send-email-stephen@networkplumber.org> References: <1428441663-3825-1-git-send-email-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH v2 3/6] examples: get rid of unneeded null checks before rte_free X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2015 21:21:05 -0000 rte_free handles getting passed a NULL pointer. Signed-off-by: Stephen Hemminger --- examples/vhost/main.c | 3 +-- examples/vhost_xen/vhost_monitor.c | 7 +++---- examples/vm_power_manager/channel_manager.c | 6 ++---- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/examples/vhost/main.c b/examples/vhost/main.c index c3fcb80..ad10f82 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -2747,8 +2747,7 @@ new_device (struct virtio_net *dev) RTE_LOG(INFO, VHOST_DATA, "(%"PRIu64") Failed to add device to data core\n", dev->device_fh); vdev->ready = DEVICE_SAFE_REMOVE; destroy_device(dev); - if (vdev->regions_hpa) - rte_free(vdev->regions_hpa); + rte_free(vdev->regions_hpa); rte_free(vdev); return -1; } diff --git a/examples/vhost_xen/vhost_monitor.c b/examples/vhost_xen/vhost_monitor.c index 9d99962..6455993 100644 --- a/examples/vhost_xen/vhost_monitor.c +++ b/examples/vhost_xen/vhost_monitor.c @@ -298,10 +298,9 @@ virtio_net_config_ll *new_device(unsigned int virtio_idx, struct xen_guest *gues err: if (new_ll_dev) free(new_ll_dev); - if (virtqueue_rx) - rte_free(virtqueue_rx); - if (virtqueue_tx) - rte_free(virtqueue_tx); + rte_free(virtqueue_rx); + rte_free(virtqueue_tx); + return NULL; } diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c index 04344ae..7d892e2 100644 --- a/examples/vm_power_manager/channel_manager.c +++ b/examples/vm_power_manager/channel_manager.c @@ -800,9 +800,7 @@ channel_manager_exit(void) rte_free(vm_info); } - if (global_cpumaps != NULL) - rte_free(global_cpumaps); - if (global_vircpuinfo != NULL) - rte_free(global_vircpuinfo); + rte_free(global_cpumaps); + rte_free(global_vircpuinfo); disconnect_hypervisor(); } -- 2.1.4