diff mbox series

wifi: ath12k: fix missing unwind goto in `ath12k_pci_probe`

Message ID 20230417115921.176229-1-lnk_01@hust.edu.cn
State New
Headers show
Series wifi: ath12k: fix missing unwind goto in `ath12k_pci_probe` | expand

Commit Message

Li Ningke April 17, 2023, 11:59 a.m. UTC
Smatch complains that
drivers/net/wireless/ath/ath12k/pci.c:1198 ath12k_pci_probe() warn: 
missing unwind goto?

In order to release the allocated resources before returning an
error, the statement that directly returns the error is changed
to a goto statement that first releases the resources in the error
handling section.

Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices")
Signed-off-by: Li Ningke <lnk_01@hust.edu.cn>
Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>
---
The issue is found by static analysis and the patch remains untested.
---
 drivers/net/wireless/ath/ath12k/pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/ath/ath12k/pci.c
index ae7f6083c9fc..f523aa15885f 100644
--- a/drivers/net/wireless/ath/ath12k/pci.c
+++ b/drivers/net/wireless/ath/ath12k/pci.c
@@ -1195,7 +1195,8 @@  static int ath12k_pci_probe(struct pci_dev *pdev,
 			dev_err(&pdev->dev,
 				"Unknown hardware version found for QCN9274: 0x%x\n",
 				soc_hw_version_major);
-			return -EOPNOTSUPP;
+			ret = -EOPNOTSUPP;
+			goto err_pci_free_region;
 		}
 		break;
 	case WCN7850_DEVICE_ID: