Skip to content
Commit 5c90501a authored by Kevin Mitchell's avatar Kevin Mitchell Committed by Joerg Roedel
Browse files

iommu/amd: Only free resources once on init error



When amd_iommu=off was specified on the command line, free_X_resources
functions were called immediately after early_amd_iommu_init. They were
then called again when amd_iommu_init also failed (as expected).

Instead, call them only once: at the end of state_next() whenever
there's an error. These functions should be safe to call any time and
any number of times. However, since state_next is never called again in
an error state, the cleanup will only ever be run once.

This also ensures that cleanup code is run as soon as possible after an
error is detected rather than waiting for amd_iommu_init() to be called.

Signed-off-by: default avatarKevin Mitchell <kevmitch@arista.com>
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent bf4bff46
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment