Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c3714c8e authored by Mahesh Kumar Kalikot Veetil's avatar Mahesh Kumar Kalikot Veetil Committed by Gerrit - the friendly Code Review server
Browse files

cnss2: fix memory leaks



Allocate cal_info only if calibration times out. Also release firmware
after BDF download.

Change-Id: I8b49331e0077101daf33cc71a96704dc87f1acf6
CRs-Fixed: 2581625
Signed-off-by: default avatarMahesh Kumar Kalikot Veetil <mkalikot@codeaurora.org>
parent 041ae774
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -1979,10 +1979,6 @@ int cnss_wlan_register_driver(struct cnss_wlan_driver *driver_ops)
	if (!test_bit(CNSS_COLD_BOOT_CAL, &plat_priv->driver_state))
		goto register_driver;

	cal_info = kzalloc(sizeof(*cal_info), GFP_KERNEL);
	if (!cal_info)
		return -ENOMEM;

	cnss_pr_dbg("Start to wait for calibration to complete\n");

	timeout = cnss_get_boot_timeout(&pci_priv->pci_dev->dev);
@@ -1990,6 +1986,11 @@ int cnss_wlan_register_driver(struct cnss_wlan_driver *driver_ops)
					  msecs_to_jiffies(timeout) << 2);
	if (!ret) {
		cnss_pr_err("Timeout waiting for calibration to complete\n");

		cal_info = kzalloc(sizeof(*cal_info), GFP_KERNEL);
		if (!cal_info)
			return -ENOMEM;

		cal_info->cal_status = CNSS_CAL_TIMEOUT;
		cnss_driver_event_post(plat_priv,
				       CNSS_DRIVER_EVENT_COLD_BOOT_CAL_DONE,
+3 −0
Original line number Diff line number Diff line
@@ -595,6 +595,9 @@ int cnss_wlfw_bdf_dnld_send_sync(struct cnss_plat_data *plat_priv,
		req->seg_id++;
	}

	if (bdf_type != CNSS_BDF_DUMMY)
		release_firmware(fw_entry);

	kfree(req);
	kfree(resp);
	return 0;