diff mbox series

enic: Remove redundant free in enic_set_ringparam

Message ID 20201223123833.14733-1-dinghao.liu@zju.edu.cn (mailing list archive)
State Deferred
Delegated to: Netdev Maintainers
Headers show
Series enic: Remove redundant free in enic_set_ringparam | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 4 this patch: 4
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 4 this patch: 4
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Dinghao Liu Dec. 23, 2020, 12:38 p.m. UTC
The error handling paths in enic_alloc_vnic_resources()
have called enic_free_vnic_resources() before returning.
So we may not need to call it again on failure at caller
side.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 drivers/net/ethernet/cisco/enic/enic_ethtool.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Jakub Kicinski Dec. 23, 2020, 8:37 p.m. UTC | #1
On Wed, 23 Dec 2020 20:38:33 +0800 Dinghao Liu wrote:
> The error handling paths in enic_alloc_vnic_resources()
> have called enic_free_vnic_resources() before returning.
> So we may not need to call it again on failure at caller
> side.
> 
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>

But it's harmless, right? So the patch is just a cleanup not a fix?

In that case, could you please repost in two weeks? We're currently 
in the merge window period, we're only accepting fixes to the
networking trees.

Thanks!
Dinghao Liu Dec. 24, 2020, 10:16 a.m. UTC | #2
> On Wed, 23 Dec 2020 20:38:33 +0800 Dinghao Liu wrote:
> > The error handling paths in enic_alloc_vnic_resources()
> > have called enic_free_vnic_resources() before returning.
> > So we may not need to call it again on failure at caller
> > side.
> > 
> > Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> 
> But it's harmless, right? So the patch is just a cleanup not a fix?
> 

I think it's harmless. Since there is a check every time before freeing,
calling enic_free_vnic_resources() twice has no security issue.

> In that case, could you please repost in two weeks? We're currently 
> in the merge window period, we're only accepting fixes to the
> networking trees.
> 
> Thanks!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/cisco/enic/enic_ethtool.c b/drivers/net/ethernet/cisco/enic/enic_ethtool.c
index 1a9803f2073e..85a139d39f27 100644
--- a/drivers/net/ethernet/cisco/enic/enic_ethtool.c
+++ b/drivers/net/ethernet/cisco/enic/enic_ethtool.c
@@ -235,7 +235,6 @@  static int enic_set_ringparam(struct net_device *netdev,
 	if (err) {
 		netdev_err(netdev,
 			   "Failed to alloc vNIC resources, aborting\n");
-		enic_free_vnic_resources(enic);
 		goto err_out;
 	}
 	enic_init_vnic_resources(enic);