[dpdk-dev] net/enic:fix no return value bug

Message ID 1503478164-13185-1-git-send-email-xie.rongqiang@zte.com.cn (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Xie RongQiang Aug. 23, 2017, 8:49 a.m. UTC
  In enic_alloc_consistent() function, if the value mze malloc
faile, !mze is true, free the rz should return NULL.

Signed-off-by: Rongqiang XIE <xie.rongqiang@zte.com.cn>
---
 drivers/net/enic/enic_main.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Ferruh Yigit Aug. 28, 2017, 11:31 a.m. UTC | #1
On 8/23/2017 9:49 AM, Rongqiang XIE wrote:
> In enic_alloc_consistent() function, if the value mze malloc
> faile, !mze is true, free the rz should return NULL.
> 
> Signed-off-by: Rongqiang XIE <xie.rongqiang@zte.com.cn>

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
  
Ferruh Yigit Aug. 28, 2017, 11:36 a.m. UTC | #2
On 8/28/2017 12:31 PM, Ferruh Yigit wrote:
> On 8/23/2017 9:49 AM, Rongqiang XIE wrote:
>> In enic_alloc_consistent() function, if the value mze malloc
>> faile, !mze is true, free the rz should return NULL.
>>
>> Signed-off-by: Rongqiang XIE <xie.rongqiang@zte.com.cn>
> 
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied to dpdk-next-net/master, thanks.
  

Patch

diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 40dbec7..1d956cd 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -368,6 +368,7 @@  void enic_init_vnic_resources(struct enic *enic)
 		pr_err("%s : Failed to allocate memory for memzone list\n",
 		       __func__);
 		rte_memzone_free(rz);
+		return NULL;
 	}
 
 	mze->rz = rz;