ethdev: fix redundant function pointer check

Message ID 20181028014650.84308-1-ferruh.yigit@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series ethdev: fix redundant function pointer check |

Checks

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

Commit Message

Ferruh Yigit Oct. 28, 2018, 1:46 a.m. UTC
  RTE_FUNC_PTR_OR_ERR_RET() already does the `ethdev_uninit` NULL check.

Fixes: e489007a411c ("ethdev: add generic create/destroy ethdev APIs")
Cc: stable@dpdk.org

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 lib/librte_ethdev/rte_ethdev.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
  

Comments

Thomas Monjalon Oct. 28, 2018, 9:43 a.m. UTC | #1
28/10/2018 02:46, Ferruh Yigit:
> RTE_FUNC_PTR_OR_ERR_RET() already does the `ethdev_uninit` NULL check.
> 
> Fixes: e489007a411c ("ethdev: add generic create/destroy ethdev APIs")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>

Acked-by: Thomas Monjalon <thomas@monjalon.net>
  
Ferruh Yigit Nov. 2, 2018, 8:34 p.m. UTC | #2
On 10/28/2018 9:43 AM, Thomas Monjalon wrote:
> 28/10/2018 02:46, Ferruh Yigit:
>> RTE_FUNC_PTR_OR_ERR_RET() already does the `ethdev_uninit` NULL check.
>>
>> Fixes: e489007a411c ("ethdev: add generic create/destroy ethdev APIs")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> 
> Acked-by: Thomas Monjalon <thomas@monjalon.net>

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

Patch

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index b2ac590ae..219795e41 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -3647,11 +3647,10 @@  rte_eth_dev_destroy(struct rte_eth_dev *ethdev,
 		return -ENODEV;
 
 	RTE_FUNC_PTR_OR_ERR_RET(*ethdev_uninit, -EINVAL);
-	if (ethdev_uninit) {
-		ret = ethdev_uninit(ethdev);
-		if (ret)
-			return ret;
-	}
+
+	ret = ethdev_uninit(ethdev);
+	if (ret)
+		return ret;
 
 	return rte_eth_dev_release_port(ethdev);
 }