Commit 88ebadbf authored by Wolfram Sang's avatar Wolfram Sang Committed by Jassi Brar
Browse files

mailbox: mailbox-test: don't free the reused channel



The RX channel can be aliased to the TX channel if it has a different
MMIO. This special case needs to be handled when freeing the channels
otherwise a double-free occurs.

Fixes: 8ea4484d ("mailbox: Add generic mechanism for testing Mailbox Controllers")
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: default avatarJassi Brar <jassisinghbrar@gmail.com>
parent dd9aa1f2
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -427,7 +427,7 @@ static int mbox_test_probe(struct platform_device *pdev)
err_free_chans:
	if (tdev->tx_channel)
		mbox_free_channel(tdev->tx_channel);
	if (tdev->rx_channel)
	if (tdev->rx_channel && tdev->rx_channel != tdev->tx_channel)
		mbox_free_channel(tdev->rx_channel);
	return ret;
}
@@ -440,7 +440,7 @@ static void mbox_test_remove(struct platform_device *pdev)

	if (tdev->tx_channel)
		mbox_free_channel(tdev->tx_channel);
	if (tdev->rx_channel)
	if (tdev->rx_channel && tdev->rx_channel != tdev->tx_channel)
		mbox_free_channel(tdev->rx_channel);
}