* [bug report] iommu/amd: Improve error handling for amd_iommu_init_pci
@ 2022-03-09 7:11 Dan Carpenter
2022-03-09 8:32 ` Vasant Hegde via iommu
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2022-03-09 7:11 UTC (permalink / raw)
To: suravee.suthikulpanit; +Cc: iommu
Hello Suravee Suthikulpanit,
The patch 06687a03805e: "iommu/amd: Improve error handling for
amd_iommu_init_pci" from Mar 1, 2022, leads to the following Smatch
static checker warning:
drivers/iommu/amd/init.c:1989 amd_iommu_init_pci()
warn: duplicate check 'ret' (previous on line 1978)
drivers/iommu/amd/init.c
1951 static int __init amd_iommu_init_pci(void)
1952 {
1953 struct amd_iommu *iommu;
1954 int ret;
1955
1956 for_each_iommu(iommu) {
1957 ret = iommu_init_pci(iommu);
1958 if (ret) {
1959 pr_err("IOMMU%d: Failed to initialize IOMMU Hardware (error=%d)!\n",
1960 iommu->index, ret);
1961 goto out;
1962 }
1963 /* Need to setup range after PCI init */
1964 iommu_set_cwwb_range(iommu);
1965 }
1966
1967 /*
1968 * Order is important here to make sure any unity map requirements are
1969 * fulfilled. The unity mappings are created and written to the device
1970 * table during the amd_iommu_init_api() call.
1971 *
1972 * After that we call init_device_table_dma() to make sure any
1973 * uninitialized DTE will block DMA, and in the end we flush the caches
1974 * of all IOMMUs to make sure the changes to the device table are
1975 * active.
1976 */
1977 ret = amd_iommu_init_api();
1978 if (ret) {
The patch moved the error handling up here
1979 pr_err("IOMMU: Failed to initialize IOMMU-API interface (error=%d)!\n",
1980 ret);
1981 goto out;
1982 }
1983
1984 init_device_table_dma();
1985
1986 for_each_iommu(iommu)
1987 iommu_flush_all_caches(iommu);
1988
--> 1989 if (!ret)
Where before we just checked for errors here. This condition is
impossible now.
1990 print_iommu_info();
1991
1992 out:
1993 return ret;
1994 }
regards,
dan carpenter
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bug report] iommu/amd: Improve error handling for amd_iommu_init_pci
2022-03-09 7:11 [bug report] iommu/amd: Improve error handling for amd_iommu_init_pci Dan Carpenter
@ 2022-03-09 8:32 ` Vasant Hegde via iommu
0 siblings, 0 replies; 2+ messages in thread
From: Vasant Hegde via iommu @ 2022-03-09 8:32 UTC (permalink / raw)
To: Dan Carpenter, suravee.suthikulpanit; +Cc: iommu
On 3/9/2022 12:41 PM, Dan Carpenter wrote:
> Hello Suravee Suthikulpanit,
Dan,
Thanks for the bug report.
.../...
>
> 1979 pr_err("IOMMU: Failed to initialize IOMMU-API interface (error=%d)!\n",
> 1980 ret);
> 1981 goto out;
> 1982 }
> 1983
> 1984 init_device_table_dma();
> 1985
> 1986 for_each_iommu(iommu)
> 1987 iommu_flush_all_caches(iommu);
> 1988
> --> 1989 if (!ret)
>
> Where before we just checked for errors here. This condition is
> impossible now.
We missed to remove this check. We will send fix patch.
-Vasant
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-09 8:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-09 7:11 [bug report] iommu/amd: Improve error handling for amd_iommu_init_pci Dan Carpenter
2022-03-09 8:32 ` Vasant Hegde via iommu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.