diff options
author | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2021-11-29 02:03:44 +0300 |
---|---|---|
committer | Ilias Apalodimas <ilias.apalodimas@linaro.org> | 2021-11-30 15:11:05 +0300 |
commit | c3de051c411e024f9e63ab338071584b9460e8b3 (patch) | |
tree | ecd155d8e96bcf38bdf43fabeceb44fb138b6a28 /drivers/tpm/tpm2_tis_mmio.c | |
parent | ade37460a944aed36ae6ee634c4d4a9a22690461 (diff) | |
download | u-boot-c3de051c411e024f9e63ab338071584b9460e8b3.tar.xz |
tis: fix tpm_tis_remove()
tpm_tis_remove() leads to calling tpm_tis_ready() with the IO region
unmapped and chip->locality == -1 (locality released). This leads to a
crash in mmio_write_bytes().
The patch implements these changes:
tpm_tis_remove(): Unmap the IO region after calling tpm_tis_cleanup().
tpm_tis_cleanup(): Request locality before IO output and releasing
locality.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Diffstat (limited to 'drivers/tpm/tpm2_tis_mmio.c')
-rw-r--r-- | drivers/tpm/tpm2_tis_mmio.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/tpm/tpm2_tis_mmio.c b/drivers/tpm/tpm2_tis_mmio.c index 9cedff2225..a646ce41ff 100644 --- a/drivers/tpm/tpm2_tis_mmio.c +++ b/drivers/tpm/tpm2_tis_mmio.c @@ -118,10 +118,13 @@ iounmap: static int tpm_tis_remove(struct udevice *dev) { struct tpm_tis_chip_data *drv_data = (void *)dev_get_driver_data(dev); + int ret; + + ret = tpm_tis_cleanup(dev); iounmap(drv_data->iobase); - return tpm_tis_cleanup(dev); + return ret; } static const struct tpm_ops tpm_tis_ops = { |