[dpdk-dev] igb_uio: cast private data to correct struct type
Commit Message
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(-)
Comments
> Subject: [dpdk-dev] [PATCH] igb_uio: cast private data to correct struct type
>
> 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>
> ---
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> --
> 2.5.0
2016-03-04 13:17, Ananyev, Konstantin:
> > Subject: [dpdk-dev] [PATCH] igb_uio: cast private data to correct struct type
> >
> > 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>
>
> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Applied, thanks
@@ -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