From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 98F412BA0 for ; Thu, 3 Mar 2016 18:08:38 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 03 Mar 2016 09:08:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,532,1449561600"; d="scan'208";a="928947405" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 03 Mar 2016 09:08:23 -0800 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id u23H8NSf026164; Thu, 3 Mar 2016 17:08:23 GMT Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id u23H8Mjo018284; Thu, 3 Mar 2016 17:08:22 GMT Received: (from fyigit@localhost) by sivswdev02.ir.intel.com with id u23H8M2l018280; Thu, 3 Mar 2016 17:08:22 GMT From: Ferruh Yigit To: dev@dpdk.org Date: Thu, 3 Mar 2016 17:08:19 +0000 Message-Id: <1457024900-18245-1-git-send-email-ferruh.yigit@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH] igb_uio: cast private data to correct struct type 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: Thu, 03 Mar 2016 17:08:39 -0000 Fixes: af75078fece3 ("first public release") This was working fine because addresses of two structs are same: struct A { struct B b; } a; As above sample "a" and "b" has same address. Now casting private data back to the correct struct type, to the one stored. Signed-off-by: Ferruh Yigit --- lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c index f5617d2..3374e44 100644 --- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c +++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c @@ -561,24 +561,17 @@ fail_free: static void igbuio_pci_remove(struct pci_dev *dev) { - struct uio_info *info = pci_get_drvdata(dev); - struct rte_uio_pci_dev *udev; - - if (info->priv == NULL) { - pr_notice("Not igbuio device\n"); - return; - } - udev = info->priv; + struct rte_uio_pci_dev *udev = pci_get_drvdata(dev); sysfs_remove_group(&dev->dev.kobj, &dev_attr_grp); - uio_unregister_device(info); - igbuio_pci_release_iomem(info); + uio_unregister_device(&udev->info); + igbuio_pci_release_iomem(&udev->info); if (udev->mode == RTE_INTR_MODE_MSIX) pci_disable_msix(dev); pci_release_regions(dev); pci_disable_device(dev); pci_set_drvdata(dev, NULL); - kfree(info); + kfree(udev); } static int -- 2.5.0