From: Dan Carpenter <error27@gmail.com>
To: quic_kvalo@quicinc.com
Cc: ath12k@lists.infradead.org
Subject: [bug report] wifi: ath12k: missing clean up
Date: Thu, 16 Feb 2023 17:00:10 +0300 [thread overview]
Message-ID: <Y+426q6cfkEdb5Bv@kili> (raw)
Hello Kalle Valo,
The patch d889913205cf: "wifi: ath12k: driver for Qualcomm Wi-Fi 7
devices" from Nov 28, 2022, leads to the following Smatch static
checker warning:
drivers/net/wireless/ath/ath12k/pci.c:1198 ath12k_pci_probe()
warn: missing unwind goto?
drivers/net/wireless/ath/ath12k/pci.c
1151 static int ath12k_pci_probe(struct pci_dev *pdev,
1152 const struct pci_device_id *pci_dev)
1153 {
1154 struct ath12k_base *ab;
1155 struct ath12k_pci *ab_pci;
1156 u32 soc_hw_version_major, soc_hw_version_minor;
1157 int ret;
1158
1159 ab = ath12k_core_alloc(&pdev->dev, sizeof(*ab_pci), ATH12K_BUS_PCI);
1160 if (!ab) {
1161 dev_err(&pdev->dev, "failed to allocate ath12k base\n");
1162 return -ENOMEM;
1163 }
1164
1165 ab->dev = &pdev->dev;
1166 pci_set_drvdata(pdev, ab);
1167 ab_pci = ath12k_pci_priv(ab);
1168 ab_pci->dev_id = pci_dev->device;
1169 ab_pci->ab = ab;
1170 ab_pci->pdev = pdev;
1171 ab->hif.ops = &ath12k_pci_hif_ops;
1172 pci_set_drvdata(pdev, ab);
1173 spin_lock_init(&ab_pci->window_lock);
1174
1175 ret = ath12k_pci_claim(ab_pci, pdev);
1176 if (ret) {
1177 ath12k_err(ab, "failed to claim device: %d\n", ret);
1178 goto err_free_core;
1179 }
1180
1181 switch (pci_dev->device) {
1182 case QCN9274_DEVICE_ID:
1183 ab_pci->msi_config = &ath12k_msi_config[0];
1184 ab->static_window_map = true;
1185 ath12k_pci_read_hw_version(ab, &soc_hw_version_major,
1186 &soc_hw_version_minor);
1187 switch (soc_hw_version_major) {
1188 case ATH12K_PCI_SOC_HW_VERSION_2:
1189 ab->hw_rev = ATH12K_HW_QCN9274_HW20;
1190 break;
1191 case ATH12K_PCI_SOC_HW_VERSION_1:
1192 ab->hw_rev = ATH12K_HW_QCN9274_HW10;
1193 break;
1194 default:
1195 dev_err(&pdev->dev,
1196 "Unknown hardware version found for QCN9274: 0x%x\n",
1197 soc_hw_version_major);
--> 1198 return -EOPNOTSUPP;
ret = -EOPNOTSUPP;
goto err_pci_free_region
1199 }
1200 break;
1201 case WCN7850_DEVICE_ID:
1202 ab_pci->msi_config = &ath12k_msi_config[0];
1203 ab->static_window_map = false;
1204 ab->hw_rev = ATH12K_HW_WCN7850_HW20;
1205 break;
1206
1207 default:
1208 dev_err(&pdev->dev, "Unknown PCI device found: 0x%x\n",
1209 pci_dev->device);
1210 ret = -EOPNOTSUPP;
1211 goto err_pci_free_region;
1212 }
1213
1214 ret = ath12k_pci_msi_alloc(ab_pci);
1215 if (ret) {
1216 ath12k_err(ab, "failed to alloc msi: %d\n", ret);
1217 goto err_pci_free_region;
1218 }
1219
1220 ret = ath12k_core_pre_init(ab);
1221 if (ret)
1222 goto err_pci_msi_free;
1223
1224 ret = ath12k_mhi_register(ab_pci);
1225 if (ret) {
1226 ath12k_err(ab, "failed to register mhi: %d\n", ret);
1227 goto err_pci_msi_free;
1228 }
1229
1230 ret = ath12k_hal_srng_init(ab);
1231 if (ret)
1232 goto err_mhi_unregister;
1233
1234 ret = ath12k_ce_alloc_pipes(ab);
1235 if (ret) {
1236 ath12k_err(ab, "failed to allocate ce pipes: %d\n", ret);
1237 goto err_hal_srng_deinit;
1238 }
1239
1240 ath12k_pci_init_qmi_ce_config(ab);
1241
1242 ret = ath12k_pci_config_irq(ab);
1243 if (ret) {
1244 ath12k_err(ab, "failed to config irq: %d\n", ret);
1245 goto err_ce_free;
1246 }
1247
1248 ret = ath12k_core_init(ab);
1249 if (ret) {
1250 ath12k_err(ab, "failed to init core: %d\n", ret);
1251 goto err_free_irq;
1252 }
1253 return 0;
1254
1255 err_free_irq:
1256 ath12k_pci_free_irq(ab);
1257
1258 err_ce_free:
1259 ath12k_ce_free_pipes(ab);
1260
1261 err_hal_srng_deinit:
1262 ath12k_hal_srng_deinit(ab);
1263
1264 err_mhi_unregister:
1265 ath12k_mhi_unregister(ab_pci);
1266
1267 err_pci_msi_free:
1268 ath12k_pci_msi_free(ab_pci);
1269
1270 err_pci_free_region:
1271 ath12k_pci_free_region(ab_pci);
1272
1273 err_free_core:
1274 ath12k_core_free(ab);
1275
1276 return ret;
1277 }
regards,
dan carpenter
--
ath12k mailing list
ath12k@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/ath12k
reply other threads:[~2023-02-16 14:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y+426q6cfkEdb5Bv@kili \
--to=error27@gmail.com \
--cc=ath12k@lists.infradead.org \
--cc=quic_kvalo@quicinc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.