DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] igb_uio: cast private data to correct struct type
Date: Thu,  3 Mar 2016 17:08:19 +0000	[thread overview]
Message-ID: <1457024900-18245-1-git-send-email-ferruh.yigit@intel.com> (raw)

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 <ferruh.yigit@intel.com>
---
 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

             reply	other threads:[~2016-03-03 17:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-03 17:08 Ferruh Yigit [this message]
2016-03-03 17:08 ` [dpdk-dev] [PATCH] igb_uio: use macros for array size calculation Ferruh Yigit
2016-03-03 17:25   ` Ananyev, Konstantin
2016-03-03 17:34     ` Ferruh Yigit
2016-03-03 17:45       ` Ananyev, Konstantin
2016-03-03 18:16         ` Ferruh Yigit
2016-03-04 11:21   ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
2016-03-04 11:43     ` Ananyev, Konstantin
2016-03-07 22:30       ` Thomas Monjalon
2016-03-04 13:17 ` [dpdk-dev] [PATCH] igb_uio: cast private data to correct struct type Ananyev, Konstantin
2016-03-07 22:29   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1457024900-18245-1-git-send-email-ferruh.yigit@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).