From: Dan Holmes-Mitra <dholmesm@google.com>
To: u-boot@lists.u-boot-project.org
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Tom Rini <trini@konsulko.com>
Subject: [PATCH 1/2] tpm: tpm2_tis_mmio: Read reg size via dev_read_addr_size_index()
Date: Thu, 03 Dec 2026 02:20:39 GMT [thread overview]
Message-ID: <20261203022028.01-01-dholmesm@google.com> (raw)
In-Reply-To: <20261203022028.01-00-dholmesm@google.com>
tpm_tis_probe() previously called dev_read_u64(dev, "reg", &sz), which
reads the first 64 bits of the reg property (the base address rather
than the size) or fails outright on 32-bit #address-cells/#size-cells
device-tree nodes.
Use dev_read_addr_size_index(dev, 0, &sz) so both base address and
region size are parsed according to the parent bus cell widths, and
reject zero-sized regions.
Signed-off-by: Dan Holmes-Mitra <dholmesm@google.com>
---
drivers/tpm/tpm2_tis_mmio.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/tpm/tpm2_tis_mmio.c b/drivers/tpm/tpm2_tis_mmio.c
index fc62dcda9e..5c53f33b03 100644
--- a/drivers/tpm/tpm2_tis_mmio.c
+++ b/drivers/tpm/tpm2_tis_mmio.c
@@ -83,16 +83,12 @@ static int tpm_tis_probe(struct udevice *dev)
struct tpm_chip_priv *priv = dev_get_uclass_priv(dev);
int ret = 0;
fdt_addr_t ioaddr;
- u64 sz;
+ fdt_size_t sz;
- ioaddr = dev_read_addr(dev);
- if (ioaddr == FDT_ADDR_T_NONE)
+ ioaddr = dev_read_addr_size_index(dev, 0, &sz);
+ if (ioaddr == FDT_ADDR_T_NONE || !sz)
return log_msg_ret("ioaddr", -EINVAL);
- ret = dev_read_u64(dev, "reg", &sz);
- if (ret)
- return -EINVAL;
-
drv_data->iobase = ioremap(ioaddr, sz);
tpm_tis_ops_register(dev, &phy_ops);
ret = tpm_tis_init(dev);
--
2.56.1.911.g883d8bcb20-goog
next prev parent reply other threads:[~2026-12-03 5:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 2:20 [PATCH 0/2] tpm: Fix MMIO TIS reg size parsing and absent-device detection Dan Holmes-Mitra
2026-12-03 2:20 ` Dan Holmes-Mitra [this message]
2026-12-03 2:20 ` [PATCH 2/2] tpm: tpm2_tis_core: Reject 0xff TPM_ACCESS and invalid DID/VID Dan Holmes-Mitra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261203022028.01-01-dholmesm@google.com \
--to=dholmesm@google.com \
--cc=ilias.apalodimas@linaro.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.u-boot-project.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox