iommu/amd: Do not call sleep while holding spinlock
authorSuravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Mon, 14 Mar 2022 02:43:21 +0000 (21:43 -0500)
committerJoerg Roedel <jroedel@suse.de>
Wed, 4 May 2022 08:32:11 +0000 (10:32 +0200)
commit5edde870d3283edeaa27ab62ac4fac5ee8cae35a
treed8adaaf61e3a5436dd02c2cbb9734fec8b8f8204
parentaf2d861d4cd2a4da5137f795ee3509e6f944a25b
iommu/amd: Do not call sleep while holding spinlock

Smatch static checker warns:
drivers/iommu/amd/iommu_v2.c:133 free_device_state()
warn: sleeping in atomic context

Fixes by storing the list of struct device_state in a temporary
list, and then free the memory after releasing the spinlock.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 9f968fc70d85 ("iommu/amd: Improve amd_iommu_v2_exit()")
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Link: https://lore.kernel.org/r/20220314024321.37411-1-suravee.suthikulpanit@amd.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/amd/iommu_v2.c