Re: [PATCH 2/2] iommu/amd: Return a literal in init_gcr3_table()

From: Joerg Roedel
Date: Thu Mar 20 2025 - 04:03:40 EST


On Mon, Mar 17, 2025 at 09:43:32AM +0300, Dan Carpenter wrote:
> This code intentionally returns zero but it does it as "return ret;"
> Returning ret looks like an error path where return 0 is more
> clear and looks more intentional.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> ---
> drivers/iommu/amd/iommu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
> index ce2626801ddf..7cbcc4933c8b 100644
> --- a/drivers/iommu/amd/iommu.c
> +++ b/drivers/iommu/amd/iommu.c
> @@ -2150,7 +2150,7 @@ static int init_gcr3_table(struct iommu_dev_data *dev_data,
>
> /* Setup GCR3[0] only if domain is setup with v2 page table mode */
> if (!pdom_is_v2_pgtbl_mode(pdom))
> - return ret;
> + return 0;

There is another case of this a couple lines above in the same function.
Mind changing that as well?

Regards,

Joerg