DPDK patches and discussions
 help / color / mirror / Atom feed
* Re: [dpdk-dev] [PATCH] Fix a memnory leak bug due to malloc unproperly.
  2018-12-13 18:33 [dpdk-dev] [PATCH] Fix a memnory leak bug due to malloc unproperly AndyPei
@ 2018-12-13 14:32 ` Burakov, Anatoly
  2018-12-18  7:16 ` Xu, Rosen
  2018-12-18 19:35 ` [dpdk-dev] [PATCH v2]/driver/raw/ifpga_rawdev: fix a memory leak bug in ifpga AndyPei
  2 siblings, 0 replies; 16+ messages in thread
From: Burakov, Anatoly @ 2018-12-13 14:32 UTC (permalink / raw)
  To: AndyPei, dev

Hi Andy,

The patch headline should say what the fix is for, e.g. raw/ifpga: fix 
this or that.

If this is fixing a bug, a Fixes: tag should also be present, indicating 
the original commit that introduced the issue. If this issue is present 
in earlier releases, a Cc: stable@dpdk.org should also be added, to 
ensure that older releases get this bugfix.

For more information, please refer to DPDK contribution guidelines: 
https://doc.dpdk.org/guides/contributing/patches.html

On 13-Dec-18 6:33 PM, AndyPei wrote:
> Signed-off-by: AndyPei <andy.pei@intel.com>
> ---


-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH] Fix a memnory leak bug due to malloc unproperly.
@ 2018-12-13 18:33 AndyPei
  2018-12-13 14:32 ` Burakov, Anatoly
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: AndyPei @ 2018-12-13 18:33 UTC (permalink / raw)
  To: dev; +Cc: andy.pei

Signed-off-by: AndyPei <andy.pei@intel.com>
---
 drivers/raw/ifpga_rawdev/base/opae_hw_api.c | 30 ++++++++++++++++++++++++-----
 drivers/raw/ifpga_rawdev/base/opae_hw_api.h |  2 ++
 drivers/raw/ifpga_rawdev/ifpga_rawdev.c     |  7 +++----
 3 files changed, 30 insertions(+), 9 deletions(-)

diff --git a/drivers/raw/ifpga_rawdev/base/opae_hw_api.c b/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
index a533dfe..b9cca65 100644
--- a/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
+++ b/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
@@ -303,7 +303,29 @@ static struct opae_adapter_ops *match_ops(struct opae_adapter *adapter)
 }
 
 /**
- * opae_adapter_data_alloc - alloc opae_adapter_data data structure
+ * opae_adapter_init - init opae_adapter data structure
+ * @adpdate: pointer of opae_adater data structure
+ * @name: adapter name.
+ * @data: private data of this adapter.
+ *
+ * Return: 0 on success.
+ */
+int opae_adapter_init(struct opae_adapter *adapter,
+		const char *name, void *data)
+{
+	if (!adapter)
+		return -ENOMEM;
+
+	TAILQ_INIT(&adapter->acc_list);
+	adapter->data = data;
+	adapter->name = name;
+	adapter->ops = match_ops(adapter);
+
+	return 0;
+}
+
+/**
+ * opae_adapter_alloc - alloc opae_adapter data structure
  * @name: adapter name.
  * @data: private data of this adapter.
  *
@@ -316,10 +338,8 @@ struct opae_adapter *opae_adapter_alloc(const char *name, void *data)
 	if (!adapter)
 		return NULL;
 
-	TAILQ_INIT(&adapter->acc_list);
-	adapter->data = data;
-	adapter->name = name;
-	adapter->ops = match_ops(adapter);
+	if (opae_adapter_init(adapter, name, data))
+		return NULL;
 
 	return adapter;
 }
diff --git a/drivers/raw/ifpga_rawdev/base/opae_hw_api.h b/drivers/raw/ifpga_rawdev/base/opae_hw_api.h
index 4bbc9df..86ca771 100644
--- a/drivers/raw/ifpga_rawdev/base/opae_hw_api.h
+++ b/drivers/raw/ifpga_rawdev/base/opae_hw_api.h
@@ -225,6 +225,8 @@ struct opae_adapter {
 void *opae_adapter_data_alloc(enum opae_adapter_type type);
 #define opae_adapter_data_free(data) opae_free(data)
 
+int opae_adapter_init(struct opae_adapter *adapter,
+		const char *name, void *data);
 struct opae_adapter *opae_adapter_alloc(const char *name, void *data);
 #define opae_adapter_free(adapter) opae_free(adapter)
 
diff --git a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
index 32e318f..d433091 100644
--- a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
+++ b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
@@ -409,9 +409,10 @@
 	data->device_id = pci_dev->id.device_id;
 	data->vendor_id = pci_dev->id.vendor_id;
 
+	adapter = rawdev->dev_private;
 	/* create a opae_adapter based on above device data */
-	adapter = opae_adapter_alloc(pci_dev->device.name, data);
-	if (!adapter) {
+	ret = opae_adapter_init(adapter, pci_dev->device.name, data);
+	if (ret) {
 		ret = -ENOMEM;
 		goto free_adapter_data;
 	}
@@ -420,8 +421,6 @@
 	rawdev->device = &pci_dev->device;
 	rawdev->driver_name = pci_dev->device.driver->name;
 
-	rawdev->dev_private = adapter;
-
 	/* must enumerate the adapter before use it */
 	ret = opae_adapter_enumerate(adapter);
 	if (ret)
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dpdk-dev] [PATCH] Fix a memnory leak bug due to malloc unproperly.
  2018-12-13 18:33 [dpdk-dev] [PATCH] Fix a memnory leak bug due to malloc unproperly AndyPei
  2018-12-13 14:32 ` Burakov, Anatoly
@ 2018-12-18  7:16 ` Xu, Rosen
  2018-12-18 19:35 ` [dpdk-dev] [PATCH v2]/driver/raw/ifpga_rawdev: fix a memory leak bug in ifpga AndyPei
  2 siblings, 0 replies; 16+ messages in thread
From: Xu, Rosen @ 2018-12-18  7:16 UTC (permalink / raw)
  To: Pei, Andy, dev; +Cc: Pei, Andy, Xu, Rosen, Zhang, Tianfei

Hi,

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of AndyPei
> Sent: Friday, December 14, 2018 2:33
> To: dev@dpdk.org
> Cc: Pei, Andy <andy.pei@intel.com>
> Subject: [dpdk-dev] [PATCH] Fix a memnory leak bug due to malloc
> unproperly.

Miss some descriptions about this patch.

> Signed-off-by: AndyPei <andy.pei@intel.com>

It seems like this is a bug fix, so pls add fixline

> ---
>  drivers/raw/ifpga_rawdev/base/opae_hw_api.c | 30
> ++++++++++++++++++++++++-----
> drivers/raw/ifpga_rawdev/base/opae_hw_api.h |  2 ++
>  drivers/raw/ifpga_rawdev/ifpga_rawdev.c     |  7 +++----
>  3 files changed, 30 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
> b/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
> index a533dfe..b9cca65 100644
> --- a/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
> +++ b/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
> @@ -303,7 +303,29 @@ static struct opae_adapter_ops *match_ops(struct
> opae_adapter *adapter)  }
> 
>  /**
> - * opae_adapter_data_alloc - alloc opae_adapter_data data structure
> + * opae_adapter_init - init opae_adapter data structure
> + * @adpdate: pointer of opae_adater data structure
> + * @name: adapter name.
> + * @data: private data of this adapter.
> + *
> + * Return: 0 on success.
> + */
> +int opae_adapter_init(struct opae_adapter *adapter,
> +		const char *name, void *data)
> +{
> +	if (!adapter)
> +		return -ENOMEM;
> +
> +	TAILQ_INIT(&adapter->acc_list);
> +	adapter->data = data;
> +	adapter->name = name;
> +	adapter->ops = match_ops(adapter);
> +
> +	return 0;
> +}
> +
> +/**
> + * opae_adapter_alloc - alloc opae_adapter data structure
>   * @name: adapter name.
>   * @data: private data of this adapter.
>   *
> @@ -316,10 +338,8 @@ struct opae_adapter *opae_adapter_alloc(const
> char *name, void *data)
>  	if (!adapter)
>  		return NULL;
> 
> -	TAILQ_INIT(&adapter->acc_list);
> -	adapter->data = data;
> -	adapter->name = name;
> -	adapter->ops = match_ops(adapter);
> +	if (opae_adapter_init(adapter, name, data))
> +		return NULL;
> 
>  	return adapter;
>  }

The operations of opae_adapter_init() and opae_adapter_alloc() are
same, could you merge these two functions?

> diff --git a/drivers/raw/ifpga_rawdev/base/opae_hw_api.h
> b/drivers/raw/ifpga_rawdev/base/opae_hw_api.h
> index 4bbc9df..86ca771 100644
> --- a/drivers/raw/ifpga_rawdev/base/opae_hw_api.h
> +++ b/drivers/raw/ifpga_rawdev/base/opae_hw_api.h
> @@ -225,6 +225,8 @@ struct opae_adapter {  void
> *opae_adapter_data_alloc(enum opae_adapter_type type);  #define
> opae_adapter_data_free(data) opae_free(data)
> 
> +int opae_adapter_init(struct opae_adapter *adapter,
> +		const char *name, void *data);
>  struct opae_adapter *opae_adapter_alloc(const char *name, void *data);
> #define opae_adapter_free(adapter) opae_free(adapter)
> 
> diff --git a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
> b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
> index 32e318f..d433091 100644
> --- a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
> +++ b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
> @@ -409,9 +409,10 @@
>  	data->device_id = pci_dev->id.device_id;
>  	data->vendor_id = pci_dev->id.vendor_id;
> 
> +	adapter = rawdev->dev_private;
>  	/* create a opae_adapter based on above device data */
> -	adapter = opae_adapter_alloc(pci_dev->device.name, data);
> -	if (!adapter) {
> +	ret = opae_adapter_init(adapter, pci_dev->device.name, data);
> +	if (ret) {
>  		ret = -ENOMEM;
>  		goto free_adapter_data;
>  	}
> @@ -420,8 +421,6 @@
>  	rawdev->device = &pci_dev->device;
>  	rawdev->driver_name = pci_dev->device.driver->name;
> 
> -	rawdev->dev_private = adapter;
> -
>  	/* must enumerate the adapter before use it */
>  	ret = opae_adapter_enumerate(adapter);
>  	if (ret)
> --
> 1.8.3.1

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH v2]/driver/raw/ifpga_rawdev: fix a memory leak bug in ifpga
  2018-12-13 18:33 [dpdk-dev] [PATCH] Fix a memnory leak bug due to malloc unproperly AndyPei
  2018-12-13 14:32 ` Burakov, Anatoly
  2018-12-18  7:16 ` Xu, Rosen
@ 2018-12-18 19:35 ` AndyPei
  2018-12-19  7:16   ` Xu, Rosen
  2018-12-25 14:02   ` [dpdk-dev] [PATCH v3]/driver/raw/ifpga_rawdev: " AndyPei
  2 siblings, 2 replies; 16+ messages in thread
From: AndyPei @ 2018-12-18 19:35 UTC (permalink / raw)
  To: dev; +Cc: rosen.xu, tianfei.zhang, andy.pei

When ifpga_rawdev_create() allocate memory for a new rawdev, the 
original code allocate redundant memory for adapter, which is a 
member of the rawdev. What is actually necessary is the adapter 
to be initialized, not memory allocated.

fixes:ef1e8ede3da5
cc:rosen.xu@intel.com
cc:tianfei.zhang@intel.com

Signed-off-by: AndyPei <andy.pei@intel.com>
---
 drivers/raw/ifpga_rawdev/base/opae_hw_api.c | 32 ++++++++++++++++++++++++-----
 drivers/raw/ifpga_rawdev/base/opae_hw_api.h |  4 +++-
 drivers/raw/ifpga_rawdev/ifpga_rawdev.c     |  7 +++----
 3 files changed, 33 insertions(+), 10 deletions(-)

diff --git a/drivers/raw/ifpga_rawdev/base/opae_hw_api.c b/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
index a533dfe..50f6438 100644
--- a/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
+++ b/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
@@ -303,12 +303,35 @@ static struct opae_adapter_ops *match_ops(struct opae_adapter *adapter)
 }
 
 /**
- * opae_adapter_data_alloc - alloc opae_adapter_data data structure
+ * opae_adapter_init - init opae_adapter data structure
+ * @adpdate: pointer of opae_adater data structure
+ * @name: adapter name.
+ * @data: private data of this adapter.
+ *
+ * Return: 0 on success.
+ */
+int opae_adapter_init(struct opae_adapter *adapter,
+		const char *name, void *data)
+{
+	if (!adapter)
+		return -ENOMEM;
+
+	TAILQ_INIT(&adapter->acc_list);
+	adapter->data = data;
+	adapter->name = name;
+	adapter->ops = match_ops(adapter);
+
+	return 0;
+}
+
+/**
+ * opae_adapter_alloc - alloc opae_adapter data structure
  * @name: adapter name.
  * @data: private data of this adapter.
  *
  * Return: opae_adapter on success, otherwise NULL.
  */
+ /**This function will no longer be called.
 struct opae_adapter *opae_adapter_alloc(const char *name, void *data)
 {
 	struct opae_adapter *adapter = opae_zmalloc(sizeof(*adapter));
@@ -316,13 +339,12 @@ struct opae_adapter *opae_adapter_alloc(const char *name, void *data)
 	if (!adapter)
 		return NULL;
 
-	TAILQ_INIT(&adapter->acc_list);
-	adapter->data = data;
-	adapter->name = name;
-	adapter->ops = match_ops(adapter);
+	if (opae_adapter_init(adapter, name, data))
+		return NULL;
 
 	return adapter;
 }
+**/
 
 /**
  * opae_adapter_enumerate - enumerate this adapter
diff --git a/drivers/raw/ifpga_rawdev/base/opae_hw_api.h b/drivers/raw/ifpga_rawdev/base/opae_hw_api.h
index 4bbc9df..ac1941a 100644
--- a/drivers/raw/ifpga_rawdev/base/opae_hw_api.h
+++ b/drivers/raw/ifpga_rawdev/base/opae_hw_api.h
@@ -225,7 +225,9 @@ struct opae_adapter {
 void *opae_adapter_data_alloc(enum opae_adapter_type type);
 #define opae_adapter_data_free(data) opae_free(data)
 
-struct opae_adapter *opae_adapter_alloc(const char *name, void *data);
+int opae_adapter_init(struct opae_adapter *adapter,
+		const char *name, void *data);
+//struct opae_adapter *opae_adapter_alloc(const char *name, void *data);
 #define opae_adapter_free(adapter) opae_free(adapter)
 
 int opae_adapter_enumerate(struct opae_adapter *adapter);
diff --git a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
index 32e318f..d433091 100644
--- a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
+++ b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
@@ -409,9 +409,10 @@
 	data->device_id = pci_dev->id.device_id;
 	data->vendor_id = pci_dev->id.vendor_id;
 
+	adapter = rawdev->dev_private;
 	/* create a opae_adapter based on above device data */
-	adapter = opae_adapter_alloc(pci_dev->device.name, data);
-	if (!adapter) {
+	ret = opae_adapter_init(adapter, pci_dev->device.name, data);
+	if (ret) {
 		ret = -ENOMEM;
 		goto free_adapter_data;
 	}
@@ -420,8 +421,6 @@
 	rawdev->device = &pci_dev->device;
 	rawdev->driver_name = pci_dev->device.driver->name;
 
-	rawdev->dev_private = adapter;
-
 	/* must enumerate the adapter before use it */
 	ret = opae_adapter_enumerate(adapter);
 	if (ret)
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dpdk-dev] [PATCH v2]/driver/raw/ifpga_rawdev: fix a memory leak bug in ifpga
  2018-12-18 19:35 ` [dpdk-dev] [PATCH v2]/driver/raw/ifpga_rawdev: fix a memory leak bug in ifpga AndyPei
@ 2018-12-19  7:16   ` Xu, Rosen
  2018-12-19  8:42     ` Pei, Andy
  2018-12-25 14:02   ` [dpdk-dev] [PATCH v3]/driver/raw/ifpga_rawdev: " AndyPei
  1 sibling, 1 reply; 16+ messages in thread
From: Xu, Rosen @ 2018-12-19  7:16 UTC (permalink / raw)
  To: Pei, Andy, dev; +Cc: Zhang, Tianfei

Hi Andy,

> -----Original Message-----
> From: Pei, Andy
> Sent: Wednesday, December 19, 2018 3:35
> To: dev@dpdk.org
> Cc: Xu, Rosen <rosen.xu@intel.com>; Zhang, Tianfei
> <tianfei.zhang@intel.com>; Pei, Andy <andy.pei@intel.com>
> Subject: [PATCH v2]/driver/raw/ifpga_rawdev: fix a memory leak bug in ifpga
> 
> When ifpga_rawdev_create() allocate memory for a new rawdev, the original
> code allocate redundant memory for adapter, which is a member of the
> rawdev. What is actually necessary is the adapter to be initialized, not
> memory allocated.
> 
> fixes:ef1e8ede3da5
> cc:rosen.xu@intel.com
> cc:tianfei.zhang@intel.com
> 
> Signed-off-by: AndyPei <andy.pei@intel.com>
> ---
>  drivers/raw/ifpga_rawdev/base/opae_hw_api.c | 32
> ++++++++++++++++++++++++-----
> drivers/raw/ifpga_rawdev/base/opae_hw_api.h |  4 +++-
>  drivers/raw/ifpga_rawdev/ifpga_rawdev.c     |  7 +++----
>  3 files changed, 33 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
> b/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
> index a533dfe..50f6438 100644
> --- a/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
> +++ b/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
> @@ -303,12 +303,35 @@ static struct opae_adapter_ops *match_ops(struct
> opae_adapter *adapter)  }
> 
>  /**
> - * opae_adapter_data_alloc - alloc opae_adapter_data data structure
> + * opae_adapter_init - init opae_adapter data structure
> + * @adpdate: pointer of opae_adater data structure
> + * @name: adapter name.
> + * @data: private data of this adapter.
> + *
> + * Return: 0 on success.
> + */
> +int opae_adapter_init(struct opae_adapter *adapter,
> +		const char *name, void *data)
> +{
> +	if (!adapter)
> +		return -ENOMEM;
> +
> +	TAILQ_INIT(&adapter->acc_list);
> +	adapter->data = data;
> +	adapter->name = name;
> +	adapter->ops = match_ops(adapter);
> +
> +	return 0;
> +}
> +
> +/**
> + * opae_adapter_alloc - alloc opae_adapter data structure
>   * @name: adapter name.
>   * @data: private data of this adapter.
>   *
>   * Return: opae_adapter on success, otherwise NULL.
>   */
> + /**This function will no longer be called.
>  struct opae_adapter *opae_adapter_alloc(const char *name, void *data)  {
>  	struct opae_adapter *adapter = opae_zmalloc(sizeof(*adapter));
> @@ -316,13 +339,12 @@ struct opae_adapter *opae_adapter_alloc(const
> char *name, void *data)
>  	if (!adapter)
>  		return NULL;
> 
> -	TAILQ_INIT(&adapter->acc_list);
> -	adapter->data = data;
> -	adapter->name = name;
> -	adapter->ops = match_ops(adapter);
> +	if (opae_adapter_init(adapter, name, data))
> +		return NULL;
> 
>  	return adapter;
>  }
To avoid redundancy, does this function useful?
> +**/
> 
>  /**
>   * opae_adapter_enumerate - enumerate this adapter diff --git
> a/drivers/raw/ifpga_rawdev/base/opae_hw_api.h
> b/drivers/raw/ifpga_rawdev/base/opae_hw_api.h
> index 4bbc9df..ac1941a 100644
> --- a/drivers/raw/ifpga_rawdev/base/opae_hw_api.h
> +++ b/drivers/raw/ifpga_rawdev/base/opae_hw_api.h
> @@ -225,7 +225,9 @@ struct opae_adapter {  void
> *opae_adapter_data_alloc(enum opae_adapter_type type);  #define
> opae_adapter_data_free(data) opae_free(data)
> 
> -struct opae_adapter *opae_adapter_alloc(const char *name, void *data);
> +int opae_adapter_init(struct opae_adapter *adapter,
> +		const char *name, void *data);
> +//struct opae_adapter *opae_adapter_alloc(const char *name, void
> +*data);
>  #define opae_adapter_free(adapter) opae_free(adapter)
> 
>  int opae_adapter_enumerate(struct opae_adapter *adapter); diff --git
> a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
> b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
> index 32e318f..d433091 100644
> --- a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
> +++ b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
> @@ -409,9 +409,10 @@
>  	data->device_id = pci_dev->id.device_id;
>  	data->vendor_id = pci_dev->id.vendor_id;
> 
> +	adapter = rawdev->dev_private;
>  	/* create a opae_adapter based on above device data */
> -	adapter = opae_adapter_alloc(pci_dev->device.name, data);
> -	if (!adapter) {
> +	ret = opae_adapter_init(adapter, pci_dev->device.name, data);
> +	if (ret) {
>  		ret = -ENOMEM;
>  		goto free_adapter_data;

Return error from opae_adapter_init() will cause free data?
Do you need to free data?

>  	}
> @@ -420,8 +421,6 @@
>  	rawdev->device = &pci_dev->device;
>  	rawdev->driver_name = pci_dev->device.driver->name;
> 
> -	rawdev->dev_private = adapter;
> -
>  	/* must enumerate the adapter before use it */
>  	ret = opae_adapter_enumerate(adapter);
>  	if (ret)
> --
> 1.8.3.1

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dpdk-dev] [PATCH v2]/driver/raw/ifpga_rawdev: fix a memory leak bug in ifpga
  2018-12-19  7:16   ` Xu, Rosen
@ 2018-12-19  8:42     ` Pei, Andy
  0 siblings, 0 replies; 16+ messages in thread
From: Pei, Andy @ 2018-12-19  8:42 UTC (permalink / raw)
  To: Xu, Rosen, dev, Zhang, Tianfei; +Cc: Zhang, Tianfei

Hi, Tianfei,

After checking the code, I found that opae_adapter_alloc() function is no long called. So is it Ok to delete the function?

To:
I agree that the free is not necessary.


-----Original Message-----
From: Xu, Rosen 
Sent: Wednesday, December 19, 2018 3:16 PM
To: Pei, Andy <andy.pei@intel.com>; dev@dpdk.org
Cc: Zhang, Tianfei <tianfei.zhang@intel.com>
Subject: RE: [PATCH v2]/driver/raw/ifpga_rawdev: fix a memory leak bug in ifpga

Hi Andy,

> -----Original Message-----
> From: Pei, Andy
> Sent: Wednesday, December 19, 2018 3:35
> To: dev@dpdk.org
> Cc: Xu, Rosen <rosen.xu@intel.com>; Zhang, Tianfei 
> <tianfei.zhang@intel.com>; Pei, Andy <andy.pei@intel.com>
> Subject: [PATCH v2]/driver/raw/ifpga_rawdev: fix a memory leak bug in 
> ifpga
> 
> When ifpga_rawdev_create() allocate memory for a new rawdev, the 
> original code allocate redundant memory for adapter, which is a member 
> of the rawdev. What is actually necessary is the adapter to be 
> initialized, not memory allocated.
> 
> fixes:ef1e8ede3da5
> cc:rosen.xu@intel.com
> cc:tianfei.zhang@intel.com
> 
> Signed-off-by: AndyPei <andy.pei@intel.com>
> ---
>  drivers/raw/ifpga_rawdev/base/opae_hw_api.c | 32
> ++++++++++++++++++++++++-----
> drivers/raw/ifpga_rawdev/base/opae_hw_api.h |  4 +++-
>  drivers/raw/ifpga_rawdev/ifpga_rawdev.c     |  7 +++----
>  3 files changed, 33 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
> b/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
> index a533dfe..50f6438 100644
> --- a/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
> +++ b/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
> @@ -303,12 +303,35 @@ static struct opae_adapter_ops *match_ops(struct 
> opae_adapter *adapter)  }
> 
>  /**
> - * opae_adapter_data_alloc - alloc opae_adapter_data data structure
> + * opae_adapter_init - init opae_adapter data structure
> + * @adpdate: pointer of opae_adater data structure
> + * @name: adapter name.
> + * @data: private data of this adapter.
> + *
> + * Return: 0 on success.
> + */
> +int opae_adapter_init(struct opae_adapter *adapter,
> +		const char *name, void *data)
> +{
> +	if (!adapter)
> +		return -ENOMEM;
> +
> +	TAILQ_INIT(&adapter->acc_list);
> +	adapter->data = data;
> +	adapter->name = name;
> +	adapter->ops = match_ops(adapter);
> +
> +	return 0;
> +}
> +
> +/**
> + * opae_adapter_alloc - alloc opae_adapter data structure
>   * @name: adapter name.
>   * @data: private data of this adapter.
>   *
>   * Return: opae_adapter on success, otherwise NULL.
>   */
> + /**This function will no longer be called.
>  struct opae_adapter *opae_adapter_alloc(const char *name, void *data)  {
>  	struct opae_adapter *adapter = opae_zmalloc(sizeof(*adapter)); @@ 
> -316,13 +339,12 @@ struct opae_adapter *opae_adapter_alloc(const char 
> *name, void *data)
>  	if (!adapter)
>  		return NULL;
> 
> -	TAILQ_INIT(&adapter->acc_list);
> -	adapter->data = data;
> -	adapter->name = name;
> -	adapter->ops = match_ops(adapter);
> +	if (opae_adapter_init(adapter, name, data))
> +		return NULL;
> 
>  	return adapter;
>  }
To avoid redundancy, does this function useful?
> +**/
> 
>  /**
>   * opae_adapter_enumerate - enumerate this adapter diff --git 
> a/drivers/raw/ifpga_rawdev/base/opae_hw_api.h
> b/drivers/raw/ifpga_rawdev/base/opae_hw_api.h
> index 4bbc9df..ac1941a 100644
> --- a/drivers/raw/ifpga_rawdev/base/opae_hw_api.h
> +++ b/drivers/raw/ifpga_rawdev/base/opae_hw_api.h
> @@ -225,7 +225,9 @@ struct opae_adapter {  void 
> *opae_adapter_data_alloc(enum opae_adapter_type type);  #define
> opae_adapter_data_free(data) opae_free(data)
> 
> -struct opae_adapter *opae_adapter_alloc(const char *name, void 
> *data);
> +int opae_adapter_init(struct opae_adapter *adapter,
> +		const char *name, void *data);
> +//struct opae_adapter *opae_adapter_alloc(const char *name, void 
> +*data);
>  #define opae_adapter_free(adapter) opae_free(adapter)
> 
>  int opae_adapter_enumerate(struct opae_adapter *adapter); diff --git 
> a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
> b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
> index 32e318f..d433091 100644
> --- a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
> +++ b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
> @@ -409,9 +409,10 @@
>  	data->device_id = pci_dev->id.device_id;
>  	data->vendor_id = pci_dev->id.vendor_id;
> 
> +	adapter = rawdev->dev_private;
>  	/* create a opae_adapter based on above device data */
> -	adapter = opae_adapter_alloc(pci_dev->device.name, data);
> -	if (!adapter) {
> +	ret = opae_adapter_init(adapter, pci_dev->device.name, data);
> +	if (ret) {
>  		ret = -ENOMEM;
>  		goto free_adapter_data;

Return error from opae_adapter_init() will cause free data?
Do you need to free data?

>  	}
> @@ -420,8 +421,6 @@
>  	rawdev->device = &pci_dev->device;
>  	rawdev->driver_name = pci_dev->device.driver->name;
> 
> -	rawdev->dev_private = adapter;
> -
>  	/* must enumerate the adapter before use it */
>  	ret = opae_adapter_enumerate(adapter);
>  	if (ret)
> --
> 1.8.3.1

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [PATCH v3]/driver/raw/ifpga_rawdev: fix a memory leak bug in ifpga
  2018-12-18 19:35 ` [dpdk-dev] [PATCH v2]/driver/raw/ifpga_rawdev: fix a memory leak bug in ifpga AndyPei
  2018-12-19  7:16   ` Xu, Rosen
@ 2018-12-25 14:02   ` AndyPei
  2019-01-02  2:47     ` Zhang, Tianfei
                       ` (3 more replies)
  1 sibling, 4 replies; 16+ messages in thread
From: AndyPei @ 2018-12-25 14:02 UTC (permalink / raw)
  To: dev; +Cc: rosen.xu, tianfei.zhang, andy.pei

When ifpga_rawdev_create() allocate memory for a new rawdev, the original code
allocate redundant memory for adapter, which is a member of the rawdev.
What is actually necessary is the adapter to be initialized, not memory allocated.

What is different in v3 from v2 is that the adapter is no longer need to be freed.

fixes:ef1e8ede3da5
cc: rosen.xu@intel.com
cc: tianfei.zhang@intel.com

Signed-off-by: AndyPei <andy.pei@intel.com>
---
 drivers/raw/ifpga_rawdev/base/opae_hw_api.c | 32 ++++++++++++++++++++++++-----
 drivers/raw/ifpga_rawdev/base/opae_hw_api.h |  3 ++-
 drivers/raw/ifpga_rawdev/ifpga_rawdev.c     | 12 ++++-------
 3 files changed, 33 insertions(+), 14 deletions(-)

diff --git a/drivers/raw/ifpga_rawdev/base/opae_hw_api.c b/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
index a533dfe..50f6438 100644
--- a/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
+++ b/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
@@ -303,12 +303,35 @@ static struct opae_adapter_ops *match_ops(struct opae_adapter *adapter)
 }
 
 /**
- * opae_adapter_data_alloc - alloc opae_adapter_data data structure
+ * opae_adapter_init - init opae_adapter data structure
+ * @adpdate: pointer of opae_adater data structure
+ * @name: adapter name.
+ * @data: private data of this adapter.
+ *
+ * Return: 0 on success.
+ */
+int opae_adapter_init(struct opae_adapter *adapter,
+		const char *name, void *data)
+{
+	if (!adapter)
+		return -ENOMEM;
+
+	TAILQ_INIT(&adapter->acc_list);
+	adapter->data = data;
+	adapter->name = name;
+	adapter->ops = match_ops(adapter);
+
+	return 0;
+}
+
+/**
+ * opae_adapter_alloc - alloc opae_adapter data structure
  * @name: adapter name.
  * @data: private data of this adapter.
  *
  * Return: opae_adapter on success, otherwise NULL.
  */
+ /**This function will no longer be called.
 struct opae_adapter *opae_adapter_alloc(const char *name, void *data)
 {
 	struct opae_adapter *adapter = opae_zmalloc(sizeof(*adapter));
@@ -316,13 +339,12 @@ struct opae_adapter *opae_adapter_alloc(const char *name, void *data)
 	if (!adapter)
 		return NULL;
 
-	TAILQ_INIT(&adapter->acc_list);
-	adapter->data = data;
-	adapter->name = name;
-	adapter->ops = match_ops(adapter);
+	if (opae_adapter_init(adapter, name, data))
+		return NULL;
 
 	return adapter;
 }
+**/
 
 /**
  * opae_adapter_enumerate - enumerate this adapter
diff --git a/drivers/raw/ifpga_rawdev/base/opae_hw_api.h b/drivers/raw/ifpga_rawdev/base/opae_hw_api.h
index 4bbc9df..332e0f3 100644
--- a/drivers/raw/ifpga_rawdev/base/opae_hw_api.h
+++ b/drivers/raw/ifpga_rawdev/base/opae_hw_api.h
@@ -225,7 +225,8 @@ struct opae_adapter {
 void *opae_adapter_data_alloc(enum opae_adapter_type type);
 #define opae_adapter_data_free(data) opae_free(data)
 
-struct opae_adapter *opae_adapter_alloc(const char *name, void *data);
+int opae_adapter_init(struct opae_adapter *adapter,
+		const char *name, void *data);
 #define opae_adapter_free(adapter) opae_free(adapter)
 
 int opae_adapter_enumerate(struct opae_adapter *adapter);
diff --git a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
index 32e318f..da772d0 100644
--- a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
+++ b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c
@@ -409,9 +409,10 @@
 	data->device_id = pci_dev->id.device_id;
 	data->vendor_id = pci_dev->id.vendor_id;
 
+	adapter = rawdev->dev_private;
 	/* create a opae_adapter based on above device data */
-	adapter = opae_adapter_alloc(pci_dev->device.name, data);
-	if (!adapter) {
+	ret = opae_adapter_init(adapter, pci_dev->device.name, data);
+	if (ret) {
 		ret = -ENOMEM;
 		goto free_adapter_data;
 	}
@@ -420,12 +421,10 @@
 	rawdev->device = &pci_dev->device;
 	rawdev->driver_name = pci_dev->device.driver->name;
 
-	rawdev->dev_private = adapter;
-
 	/* must enumerate the adapter before use it */
 	ret = opae_adapter_enumerate(adapter);
 	if (ret)
-		goto free_adapter;
+		goto free_adapter_data;
 
 	/* get opae_manager to rawdev */
 	mgr = opae_adapter_get_mgr(adapter);
@@ -436,9 +435,6 @@
 
 	return ret;
 
-free_adapter:
-	if (adapter)
-		opae_adapter_free(adapter);
 free_adapter_data:
 	if (data)
 		opae_adapter_data_free(data);
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dpdk-dev] [PATCH v3]/driver/raw/ifpga_rawdev: fix a memory leak bug in ifpga
  2018-12-25 14:02   ` [dpdk-dev] [PATCH v3]/driver/raw/ifpga_rawdev: " AndyPei
@ 2019-01-02  2:47     ` Zhang, Tianfei
  2019-01-02  6:52     ` Xu, Rosen
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 16+ messages in thread
From: Zhang, Tianfei @ 2019-01-02  2:47 UTC (permalink / raw)
  To: Pei, Andy, dev; +Cc: Xu, Rosen


> -----Original Message-----
> From: Pei, Andy
> Sent: Tuesday, December 25, 2018 10:02 PM
> To: dev@dpdk.org
> Cc: Xu, Rosen <rosen.xu@intel.com>; Zhang, Tianfei
> <tianfei.zhang@intel.com>; Pei, Andy <andy.pei@intel.com>
> Subject: [PATCH v3]/driver/raw/ifpga_rawdev: fix a memory leak bug in ifpga
> 
> When ifpga_rawdev_create() allocate memory for a new rawdev, the
> original code allocate redundant memory for adapter, which is a member of
> the rawdev.
> What is actually necessary is the adapter to be initialized, not memory
> allocated.
> 
> What is different in v3 from v2 is that the adapter is no longer need to be
> freed.
> 
> fixes:ef1e8ede3da5
> cc: rosen.xu@intel.com
> cc: tianfei.zhang@intel.com

It looks good for me, Acked-by: Tianfei zhang <tianfei.zhang@intel.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dpdk-dev] [PATCH v3]/driver/raw/ifpga_rawdev: fix a memory leak bug in ifpga
  2018-12-25 14:02   ` [dpdk-dev] [PATCH v3]/driver/raw/ifpga_rawdev: " AndyPei
  2019-01-02  2:47     ` Zhang, Tianfei
@ 2019-01-02  6:52     ` Xu, Rosen
  2019-01-15  0:03     ` Thomas Monjalon
  2019-01-15  5:38     ` [dpdk-dev] [DPDK] [PATCH v4] raw/ifpga: fix a typo and delete code of unused function Andy Pei
  3 siblings, 0 replies; 16+ messages in thread
From: Xu, Rosen @ 2019-01-02  6:52 UTC (permalink / raw)
  To: Pei, Andy, dev; +Cc: Zhang, Tianfei, Yigit, Ferruh

Hi,

> -----Original Message-----
> From: Pei, Andy
> Sent: Tuesday, December 25, 2018 22:02
> To: dev@dpdk.org
> Cc: Xu, Rosen <rosen.xu@intel.com>; Zhang, Tianfei
> <tianfei.zhang@intel.com>; Pei, Andy <andy.pei@intel.com>
> Subject: [PATCH v3]/driver/raw/ifpga_rawdev: fix a memory leak bug in ifpga
> 
> When ifpga_rawdev_create() allocate memory for a new rawdev, the original
> code allocate redundant memory for adapter, which is a member of the
> rawdev.
> What is actually necessary is the adapter to be initialized, not memory
> allocated.
> 
> What is different in v3 from v2 is that the adapter is no longer need to be
> freed.
> 
> fixes:ef1e8ede3da5
> cc: rosen.xu@intel.com
> cc: tianfei.zhang@intel.com

Acked-by: Rosen Xu <rosen.xu@intel.com>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dpdk-dev] [PATCH v3]/driver/raw/ifpga_rawdev: fix a memory leak bug in ifpga
  2018-12-25 14:02   ` [dpdk-dev] [PATCH v3]/driver/raw/ifpga_rawdev: " AndyPei
  2019-01-02  2:47     ` Zhang, Tianfei
  2019-01-02  6:52     ` Xu, Rosen
@ 2019-01-15  0:03     ` Thomas Monjalon
  2019-01-15  5:38     ` [dpdk-dev] [DPDK] [PATCH v4] raw/ifpga: fix a typo and delete code of unused function Andy Pei
  3 siblings, 0 replies; 16+ messages in thread
From: Thomas Monjalon @ 2019-01-15  0:03 UTC (permalink / raw)
  To: AndyPei; +Cc: dev, rosen.xu, tianfei.zhang

Hi Andy,

I comment here for all your patches (4 are pending).
They are your first patches for DPDK, welcome!
You may want to read the guides explaining how to contribute:
	http://doc.dpdk.org/guides/contributing/patches.html

The title should be "raw/ifpga: fix memory leak in [area here]"

25/12/2018 15:02, AndyPei:
> When ifpga_rawdev_create() allocate memory for a new rawdev, the original code
> allocate redundant memory for adapter, which is a member of the rawdev.
> What is actually necessary is the adapter to be initialized, not memory allocated.
> 
> What is different in v3 from v2 is that the adapter is no longer need to be freed.

The changelog is better located after --- below.

> fixes:ef1e8ede3da5
> cc: rosen.xu@intel.com
> cc: tianfei.zhang@intel.com

The format should be a bit different.
Please use git log -1 --abbrev=12 --format='Fixes: %h (\"%s\")%nCc: %ae'
and check with devtools/check-git-log.sh

> Signed-off-by: AndyPei <andy.pei@intel.com>

Should there be a space in your name as "Andy Pei"?

[...]
>  /**
> - * opae_adapter_data_alloc - alloc opae_adapter_data data structure
> + * opae_adapter_init - init opae_adapter data structure
> + * @adpdate: pointer of opae_adater data structure
> + * @name: adapter name.
> + * @data: private data of this adapter.

The doxygen format is @param param_name param_description.
It is also important to strictly match the name of the parameter.
@adpdate is a typo (should be @param adapter).

You can build the doc with "make doc-api-html"
and check the result in your browser.

> + *
> + * Return: 0 on success.
> + */
> +int opae_adapter_init(struct opae_adapter *adapter,
> +		const char *name, void *data)

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [DPDK] [PATCH v4] raw/ifpga: fix a typo and delete code of unused function
  2018-12-25 14:02   ` [dpdk-dev] [PATCH v3]/driver/raw/ifpga_rawdev: " AndyPei
                       ` (2 preceding siblings ...)
  2019-01-15  0:03     ` Thomas Monjalon
@ 2019-01-15  5:38     ` Andy Pei
  2019-01-16 11:26       ` Xu, Rosen
  2019-01-17  5:26       ` [dpdk-dev] [DPDK] " Andy Pei
  3 siblings, 2 replies; 16+ messages in thread
From: Andy Pei @ 2019-01-15  5:38 UTC (permalink / raw)
  To: dev; +Cc: rosen.xu, tianfei.zhang, andy.pei

fix a typo and delete code of unused function

Fixes: 88c9eb7cb4b5 (\"fix a typo and delete code of unused function\")
Cc: andy.pei@intel.com
Cc: rosen.xu@intel.com
Cc: tianfei.zhang@intel.com

Signed-off-by: Andy Pei <andy.pei@intel.com>
---
 drivers/raw/ifpga_rawdev/base/opae_hw_api.c | 24 +-----------------------
 1 file changed, 1 insertion(+), 23 deletions(-)

diff --git a/drivers/raw/ifpga_rawdev/base/opae_hw_api.c b/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
index 50f6438..ea42757 100644
--- a/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
+++ b/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
@@ -304,7 +304,7 @@ static struct opae_adapter_ops *match_ops(struct opae_adapter *adapter)
 
 /**
  * opae_adapter_init - init opae_adapter data structure
- * @adpdate: pointer of opae_adater data structure
+ * @adapter: pointer of opae_adater data structure
  * @name: adapter name.
  * @data: private data of this adapter.
  *
@@ -325,28 +325,6 @@ int opae_adapter_init(struct opae_adapter *adapter,
 }
 
 /**
- * opae_adapter_alloc - alloc opae_adapter data structure
- * @name: adapter name.
- * @data: private data of this adapter.
- *
- * Return: opae_adapter on success, otherwise NULL.
- */
- /**This function will no longer be called.
-struct opae_adapter *opae_adapter_alloc(const char *name, void *data)
-{
-	struct opae_adapter *adapter = opae_zmalloc(sizeof(*adapter));
-
-	if (!adapter)
-		return NULL;
-
-	if (opae_adapter_init(adapter, name, data))
-		return NULL;
-
-	return adapter;
-}
-**/
-
-/**
  * opae_adapter_enumerate - enumerate this adapter
  * @adapter: adapter to enumerate.
  *
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dpdk-dev] [DPDK] [PATCH v4] raw/ifpga: fix a typo and delete code of unused function
  2019-01-15  5:38     ` [dpdk-dev] [DPDK] [PATCH v4] raw/ifpga: fix a typo and delete code of unused function Andy Pei
@ 2019-01-16 11:26       ` Xu, Rosen
  2019-01-17  5:26       ` [dpdk-dev] [DPDK] " Andy Pei
  1 sibling, 0 replies; 16+ messages in thread
From: Xu, Rosen @ 2019-01-16 11:26 UTC (permalink / raw)
  To: Pei, Andy, dev; +Cc: Zhang, Tianfei

Hi,

Pls don't use fixline if your patch code doesn't merged in community.

> -----Original Message-----
> From: Pei, Andy
> Sent: Tuesday, January 15, 2019 13:38
> To: dev@dpdk.org
> Cc: Xu, Rosen <rosen.xu@intel.com>; Zhang, Tianfei
> <tianfei.zhang@intel.com>; Pei, Andy <andy.pei@intel.com>
> Subject: [DPDK] [PATCH v4] raw/ifpga: fix a typo and delete code of unused
> function
> 
> fix a typo and delete code of unused function
> 
> Fixes: 88c9eb7cb4b5 (\"fix a typo and delete code of unused function\")
> Cc: andy.pei@intel.com
> Cc: rosen.xu@intel.com
> Cc: tianfei.zhang@intel.com
> 
> Signed-off-by: Andy Pei <andy.pei@intel.com>
> ---
>  drivers/raw/ifpga_rawdev/base/opae_hw_api.c | 24 +-----------------------
>  1 file changed, 1 insertion(+), 23 deletions(-)
> 
> diff --git a/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
> b/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
> index 50f6438..ea42757 100644
> --- a/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
> +++ b/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
> @@ -304,7 +304,7 @@ static struct opae_adapter_ops *match_ops(struct
> opae_adapter *adapter)
> 
>  /**
>   * opae_adapter_init - init opae_adapter data structure
> - * @adpdate: pointer of opae_adater data structure
> + * @adapter: pointer of opae_adater data structure
>   * @name: adapter name.
>   * @data: private data of this adapter.
>   *
> @@ -325,28 +325,6 @@ int opae_adapter_init(struct opae_adapter
> *adapter,  }
> 
>  /**
> - * opae_adapter_alloc - alloc opae_adapter data structure
> - * @name: adapter name.
> - * @data: private data of this adapter.
> - *
> - * Return: opae_adapter on success, otherwise NULL.
> - */
> - /**This function will no longer be called.
> -struct opae_adapter *opae_adapter_alloc(const char *name, void *data) -{
> -	struct opae_adapter *adapter = opae_zmalloc(sizeof(*adapter));
> -
> -	if (!adapter)
> -		return NULL;
> -
> -	if (opae_adapter_init(adapter, name, data))
> -		return NULL;
> -
> -	return adapter;
> -}
> -**/
> -
> -/**
>   * opae_adapter_enumerate - enumerate this adapter
>   * @adapter: adapter to enumerate.
>   *
> --
> 1.8.3.1

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [DPDK] raw/ifpga: fix a typo and delete code of unused function
  2019-01-15  5:38     ` [dpdk-dev] [DPDK] [PATCH v4] raw/ifpga: fix a typo and delete code of unused function Andy Pei
  2019-01-16 11:26       ` Xu, Rosen
@ 2019-01-17  5:26       ` Andy Pei
  2019-01-17  5:36         ` Ye Xiaolong
  2019-01-17  6:39         ` [dpdk-dev] [DPDK] raw/ifpga: fix a typo Andy Pei
  1 sibling, 2 replies; 16+ messages in thread
From: Andy Pei @ 2019-01-17  5:26 UTC (permalink / raw)
  To: dev; +Cc: rosen.xu, tianfei.zhang, andy.pei

fix a typo and delete code of unused function

Cc: andy.pei@intel.com
Cc: rosen.xu@intel.com
Cc: tianfei.zhang@intel.com

Signed-off-by: Andy Pei <andy.pei@intel.com>
---
 drivers/raw/ifpga_rawdev/base/opae_hw_api.c | 24 +-----------------------
 1 file changed, 1 insertion(+), 23 deletions(-)

diff --git a/drivers/raw/ifpga_rawdev/base/opae_hw_api.c b/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
index 50f6438..ea42757 100644
--- a/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
+++ b/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
@@ -304,7 +304,7 @@ static struct opae_adapter_ops *match_ops(struct opae_adapter *adapter)
 
 /**
  * opae_adapter_init - init opae_adapter data structure
- * @adpdate: pointer of opae_adater data structure
+ * @adapter: pointer of opae_adater data structure
  * @name: adapter name.
  * @data: private data of this adapter.
  *
@@ -325,28 +325,6 @@ int opae_adapter_init(struct opae_adapter *adapter,
 }
 
 /**
- * opae_adapter_alloc - alloc opae_adapter data structure
- * @name: adapter name.
- * @data: private data of this adapter.
- *
- * Return: opae_adapter on success, otherwise NULL.
- */
- /**This function will no longer be called.
-struct opae_adapter *opae_adapter_alloc(const char *name, void *data)
-{
-	struct opae_adapter *adapter = opae_zmalloc(sizeof(*adapter));
-
-	if (!adapter)
-		return NULL;
-
-	if (opae_adapter_init(adapter, name, data))
-		return NULL;
-
-	return adapter;
-}
-**/
-
-/**
  * opae_adapter_enumerate - enumerate this adapter
  * @adapter: adapter to enumerate.
  *
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dpdk-dev] [DPDK] raw/ifpga: fix a typo and delete code of unused function
  2019-01-17  5:26       ` [dpdk-dev] [DPDK] " Andy Pei
@ 2019-01-17  5:36         ` Ye Xiaolong
  2019-01-17  6:39         ` [dpdk-dev] [DPDK] raw/ifpga: fix a typo Andy Pei
  1 sibling, 0 replies; 16+ messages in thread
From: Ye Xiaolong @ 2019-01-17  5:36 UTC (permalink / raw)
  To: Andy Pei; +Cc: dev, rosen.xu, tianfei.zhang

On 01/17, Andy Pei wrote:
>fix a typo and delete code of unused function
>
>Cc: andy.pei@intel.com
>Cc: rosen.xu@intel.com
>Cc: tianfei.zhang@intel.com
>
>Signed-off-by: Andy Pei <andy.pei@intel.com>
>---
> drivers/raw/ifpga_rawdev/base/opae_hw_api.c | 24 +-----------------------
> 1 file changed, 1 insertion(+), 23 deletions(-)
>
>diff --git a/drivers/raw/ifpga_rawdev/base/opae_hw_api.c b/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
>index 50f6438..ea42757 100644
>--- a/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
>+++ b/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
>@@ -304,7 +304,7 @@ static struct opae_adapter_ops *match_ops(struct opae_adapter *adapter)
> 
> /**
>  * opae_adapter_init - init opae_adapter data structure
>- * @adpdate: pointer of opae_adater data structure
>+ * @adapter: pointer of opae_adater data structure

Seems there is another typo here, s/opae_adater/opae_adapter/

Thanks,
Xiaolong

>  * @name: adapter name.
>  * @data: private data of this adapter.
>  *
>@@ -325,28 +325,6 @@ int opae_adapter_init(struct opae_adapter *adapter,
> }
> 
> /**
>- * opae_adapter_alloc - alloc opae_adapter data structure
>- * @name: adapter name.
>- * @data: private data of this adapter.
>- *
>- * Return: opae_adapter on success, otherwise NULL.
>- */
>- /**This function will no longer be called.
>-struct opae_adapter *opae_adapter_alloc(const char *name, void *data)
>-{
>-	struct opae_adapter *adapter = opae_zmalloc(sizeof(*adapter));
>-
>-	if (!adapter)
>-		return NULL;
>-
>-	if (opae_adapter_init(adapter, name, data))
>-		return NULL;
>-
>-	return adapter;
>-}
>-**/
>-
>-/**
>  * opae_adapter_enumerate - enumerate this adapter
>  * @adapter: adapter to enumerate.
>  *
>-- 
>1.8.3.1
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [dpdk-dev] [DPDK] raw/ifpga: fix a typo
  2019-01-17  5:26       ` [dpdk-dev] [DPDK] " Andy Pei
  2019-01-17  5:36         ` Ye Xiaolong
@ 2019-01-17  6:39         ` Andy Pei
  2019-01-17  8:39           ` Xu, Rosen
  1 sibling, 1 reply; 16+ messages in thread
From: Andy Pei @ 2019-01-17  6:39 UTC (permalink / raw)
  To: dev; +Cc: rosen.xu, tianfei.zhang, andy.pei

fix a typo

Cc: andy.pei@intel.com
Cc: rosen.xu@intel.com
Cc: tianfei.zhang@intel.com

Signed-off-by: Andy Pei <andy.pei@intel.com>
---
 drivers/raw/ifpga_rawdev/base/opae_hw_api.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/raw/ifpga_rawdev/base/opae_hw_api.c b/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
index ea42757..1541b67 100644
--- a/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
+++ b/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
@@ -304,7 +304,7 @@ static struct opae_adapter_ops *match_ops(struct opae_adapter *adapter)
 
 /**
  * opae_adapter_init - init opae_adapter data structure
- * @adapter: pointer of opae_adater data structure
+ * @adapter: pointer of opae_adapter data structure
  * @name: adapter name.
  * @data: private data of this adapter.
  *
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [dpdk-dev] [DPDK] raw/ifpga: fix a typo
  2019-01-17  6:39         ` [dpdk-dev] [DPDK] raw/ifpga: fix a typo Andy Pei
@ 2019-01-17  8:39           ` Xu, Rosen
  0 siblings, 0 replies; 16+ messages in thread
From: Xu, Rosen @ 2019-01-17  8:39 UTC (permalink / raw)
  To: Pei, Andy, dev; +Cc: Zhang, Tianfei, Ye, Xiaolong

Hi,

> -----Original Message-----
> From: Pei, Andy
> Sent: Thursday, January 17, 2019 14:40
> To: dev@dpdk.org
> Cc: Xu, Rosen <rosen.xu@intel.com>; Zhang, Tianfei
> <tianfei.zhang@intel.com>; Pei, Andy <andy.pei@intel.com>
> Subject: [DPDK] raw/ifpga: fix a typo
Which version number?

> fix a typo
Pls descript it in detail.

> Cc: andy.pei@intel.com
> Cc: rosen.xu@intel.com
> Cc: tianfei.zhang@intel.com
Miss fixline.

> Signed-off-by: Andy Pei <andy.pei@intel.com>
> ---
>  drivers/raw/ifpga_rawdev/base/opae_hw_api.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
> b/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
> index ea42757..1541b67 100644
> --- a/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
> +++ b/drivers/raw/ifpga_rawdev/base/opae_hw_api.c
> @@ -304,7 +304,7 @@ static struct opae_adapter_ops *match_ops(struct
> opae_adapter *adapter)
> 
>  /**
>   * opae_adapter_init - init opae_adapter data structure
> - * @adapter: pointer of opae_adater data structure
> + * @adapter: pointer of opae_adapter data structure
>   * @name: adapter name.
>   * @data: private data of this adapter.
>   *
> --
> 1.8.3.1

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2019-01-17  8:39 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-13 18:33 [dpdk-dev] [PATCH] Fix a memnory leak bug due to malloc unproperly AndyPei
2018-12-13 14:32 ` Burakov, Anatoly
2018-12-18  7:16 ` Xu, Rosen
2018-12-18 19:35 ` [dpdk-dev] [PATCH v2]/driver/raw/ifpga_rawdev: fix a memory leak bug in ifpga AndyPei
2018-12-19  7:16   ` Xu, Rosen
2018-12-19  8:42     ` Pei, Andy
2018-12-25 14:02   ` [dpdk-dev] [PATCH v3]/driver/raw/ifpga_rawdev: " AndyPei
2019-01-02  2:47     ` Zhang, Tianfei
2019-01-02  6:52     ` Xu, Rosen
2019-01-15  0:03     ` Thomas Monjalon
2019-01-15  5:38     ` [dpdk-dev] [DPDK] [PATCH v4] raw/ifpga: fix a typo and delete code of unused function Andy Pei
2019-01-16 11:26       ` Xu, Rosen
2019-01-17  5:26       ` [dpdk-dev] [DPDK] " Andy Pei
2019-01-17  5:36         ` Ye Xiaolong
2019-01-17  6:39         ` [dpdk-dev] [DPDK] raw/ifpga: fix a typo Andy Pei
2019-01-17  8:39           ` Xu, Rosen

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).