Skip to contentSkip to conversation

qlcnic: Use common error handling code in four functions

PATCH In review Markus Elfring 2 participants 2 messages Sep 19, 2024 – Sep 22, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qlcnic: Use common error handling code in four functions

From: Markus Elfring <[email protected]>
Date: Thu, 19 Sep 2024 21:30:45 +0200

Add jump targets so that a bit of exception handling can be better reused at the end of four function implementations.

This issue was detected by using the Coccinelle software.

---
 .../ethernet/qlogic/qlcnic/qlcnic_83xx_init.c | 12 +--
 .../net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c | 86 ++++++++-----------
 2 files changed, 42 insertions(+), 56 deletions(-)
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c +4 -8
index b733374b4dc5..a8eaf10d9158 100644
@@ -1333,17 +1333,13 @@ static int qlcnic_83xx_copy_bootloader(struct qlcnic_adapter *adapter)
 
 	ret = qlcnic_83xx_lockless_flash_read32(adapter, src, p_cache,
 						size / sizeof(u32));
-	if (ret) {
-		vfree(p_cache);
-		return ret;
-	}
+	if (ret)
+		goto free_cache;
+
 	/* 16 byte write to MS memory */
 	ret = qlcnic_ms_mem_write128(adapter, dest, (u32 *)p_cache,
 				     size / 16);
-	if (ret) {
-		vfree(p_cache);
-		return ret;
-	}
+free_cache:
 	vfree(p_cache);
 
 	return ret;
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c +38 -48

161 lines not on this page · raw message

--
2.46.0

reviewer
#1 lore raw
Quoted 9 lines · Markus Elfring

From: Markus Elfring <[email protected]>
Date: Thu, 19 Sep 2024 21:30:45 +0200

Add jump targets so that a bit of exception handling can be better reused at the end of four function implementations.

This issue was detected by using the Coccinelle software.

Hi Markus,

This is an old driver, that doesn't appear to have been under active development for quite some time. Unless there is a way to exercise these changes I don't think that clean-ups of this nature are worth the risk of regressions they might introduce.

If we can see bugs in error paths, let's fix them. Else, let's leave them be.

Signature · 1 line
pw-bot: rejected