RE: [PATCH v4 1/6] iommu/msm: Fix error-out routine in msm_iommu_attach_dev()

From: Tian, Kevin
Date: Thu Sep 22 2022 - 04:09:12 EST


> From: Nicolin Chen <nicolinc@xxxxxxxxxx>
> Sent: Wednesday, September 21, 2022 4:23 PM
>
> The error-out routine is missing all the reverting pieces for the iop and
> attached-ctx allocations. And clock enable/disable is unbalanced too.
>
> Fix it by adding __disable_clocks() and calling msm_iommu_detach_dev() at
> the end of the msm_iommu_attach_dev() if "ret" is non-zero. Also set the
> master->num to 0 in the detach_dev() since attach_dev() would check it.
>
> Fixes: 109bd48ea2e1 ("iommu/msm: Add DT adaptation")
> Cc: stable@xxxxxxxxxxxxxxx
> Cc: Sricharan R <sricharan@xxxxxxxxxxxxxx>
> Cc: Andy Gross <agross@xxxxxxxxxx>
> Cc: Bjorn Andersson <bjorn.andersson@xxxxxxxxxx>
> Cc: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxx>
> Signed-off-by: Nicolin Chen <nicolinc@xxxxxxxxxx>

Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>