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

Commit feaaafe4 authored by Michael Adisumarta's avatar Michael Adisumarta
Browse files

msm: ipa: nullify mailbox struct after freeing



Nullify mailbox struct after freeing to prevent a mem leak.
Nullify and return if mbox_request_channel fails.

Change-Id: I9ab91654a72502f18f9be622811086655118ecc6
Signed-off-by: default avatarMichael Adisumarta <madisuma@codeaurora.org>
parent 9cd5740f
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -7023,7 +7023,9 @@ void ipa_pc_qmp_enable(void)
		ret = PTR_ERR(ipa3_ctx->mbox);
		if (ret != -EPROBE_DEFER)
			IPAERR("mailbox channel request failed, ret=%d\n", ret);
		goto cleanup;

		ipa3_ctx->mbox = NULL;
		return;
	}

	/* prepare the QMP packet to send */
@@ -7038,8 +7040,10 @@ void ipa_pc_qmp_enable(void)
	}

cleanup:
	ipa3_ctx->mbox = NULL;
	if (ipa3_ctx->mbox) {
		mbox_free_channel(ipa3_ctx->mbox);
		ipa3_ctx->mbox = NULL;
	}
}

/**************************************************************