summaryrefslogtreecommitdiffstats
path: root/drivers/iommu/mtk_iommu.c
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2022-12-07 16:56:09 +0100
committerJoerg Roedel <jroedel@suse.de>2022-12-12 12:05:56 +0100
commit462e768b55a2331324ff72e74706261134369826 (patch)
treea65019b2471c951932d8e69a24970089dc0c498e /drivers/iommu/mtk_iommu.c
parentiommu/mediatek: Fix crash on isr after kexec() (diff)
downloadlinux-462e768b55a2331324ff72e74706261134369826.tar.xz
linux-462e768b55a2331324ff72e74706261134369826.zip
iommu/mediatek: Fix forever loop in error handling
There is a typo so this loop does i++ where i-- was intended. It will result in looping until the kernel crashes. Fixes: 26593928564c ("iommu/mediatek: Add error path for loop of mm_dts_parse") Signed-off-by: Dan Carpenter <error27@gmail.com> Reviewed-by: Yong Wu <yong.wu@mediatek.com> Link: https://lore.kernel.org/r/Y5C3mTam2nkbaz6o@kili Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/mtk_iommu.c')
-rw-r--r--drivers/iommu/mtk_iommu.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 392b8c167c44..e9b3b794811d 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -1159,8 +1159,7 @@ static int mtk_iommu_mm_dts_parse(struct device *dev, struct component_match **m
return 0;
err_larbdev_put:
- /* id may be not linear mapping, loop whole the array */
- for (i = MTK_LARB_NR_MAX - 1; i >= 0; i++) {
+ for (i = MTK_LARB_NR_MAX - 1; i >= 0; i--) {
if (!data->larb_imu[i].dev)
continue;
put_device(data->larb_imu[i].dev);