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

Commit 66e6c9a4 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "memshare: Free QMI handle only if its valid"

parents 3086e620 e6fa19ad
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2013-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 */

#include <linux/err.h>
@@ -751,6 +752,7 @@ static void memshare_init_worker(struct work_struct *work)
		dev_err(memsh_child->dev,
			"memshare: Creating mem_share_svc qmi handle failed\n");
		kfree(mem_share_svc_handle);
		mem_share_svc_handle = NULL;
		destroy_workqueue(mem_share_svc_workqueue);
		return;
	}
@@ -759,8 +761,11 @@ static void memshare_init_worker(struct work_struct *work)
	if (rc < 0) {
		dev_err(memsh_child->dev,
			"memshare: Registering mem share svc failed %d\n", rc);
		if (mem_share_svc_handle) {
			qmi_handle_release(mem_share_svc_handle);
			kfree(mem_share_svc_handle);
			mem_share_svc_handle = NULL;
		}
		destroy_workqueue(mem_share_svc_workqueue);
		return;
	}
@@ -917,8 +922,11 @@ static int memshare_remove(struct platform_device *pdev)
		return 0;

	flush_workqueue(mem_share_svc_workqueue);
	if (mem_share_svc_handle) {
		qmi_handle_release(mem_share_svc_handle);
		kfree(mem_share_svc_handle);
		mem_share_svc_handle = NULL;
	}
	destroy_workqueue(mem_share_svc_workqueue);
	return 0;
}