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

Commit 810ab737 authored by Deepak Katragadda's avatar Deepak Katragadda
Browse files

msm: ssr: Remove entry from subsys list on unregistering



Currently, on a subsystem being unregistered, its entry is not
removed from the subsys list. This causes a crash when this
list is accessed at a later time.
Remove the subsys entry from the list during unregister.

Change-Id: I61f3cb82bf1ac22c6ef1374e530e14ccaaa095bb
Signed-off-by: default avatarDeepak Katragadda <dkatraga@codeaurora.org>
parent 048c6ef4
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1405,10 +1405,17 @@ EXPORT_SYMBOL(subsys_register);

void subsys_unregister(struct subsys_device *subsys)
{
	struct subsys_device *subsys_dev, *tmp;

	if (IS_ERR_OR_NULL(subsys))
		return;

	if (get_device(&subsys->dev)) {
		mutex_lock(&subsys_list_lock);
		list_for_each_entry_safe(subsys_dev, tmp, &subsys_list, list)
			if (subsys_dev == subsys)
				list_del(&subsys->list);
		mutex_unlock(&subsys_list_lock);
		mutex_lock(&subsys->track.lock);
		WARN_ON(subsys->count);
		device_unregister(&subsys->dev);