iommu/mediatek: Add platform_device_put for recovering the device refcnt
authorYong Wu <yong.wu@mediatek.com>
Tue, 18 Oct 2022 02:42:53 +0000 (10:42 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:32:51 +0000 (13:32 +0100)
commit44d7712267d1711f215805c32bdc4d423a57a5c7
treef77e499a3de0238ce5e5a2503f102a10e226db06
parentb5dd27890c6d67db534e04ff6b29a763f82ea68b
iommu/mediatek: Add platform_device_put for recovering the device refcnt

[ Upstream commit dcb40e9fcce9bd251eaff19f3724131db522846c ]

Add platform_device_put to match with of_find_device_by_node.

Meanwhile, I add a new variable "pcommdev" which is for smi common device.
Otherwise, "platform_device_put(plarbdev)" for smi-common dev may be not
readable. And add a checking for whether pcommdev is NULL.

Fixes: d2e9a1102cfc ("iommu/mediatek: Contain MM IOMMU flow with the MM TYPE")
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Link: https://lore.kernel.org/r/20221018024258.19073-2-yong.wu@mediatek.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iommu/mtk_iommu.c