summaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm/tpm_of.c
diff options
context:
space:
mode:
authorNayna Jain <nayna@linux.vnet.ibm.com>2016-11-14 05:00:55 -0500
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>2016-11-28 01:31:32 +0200
commited4fdb4f5dc758e9d5bfb5582c701b08a87115a6 (patch)
treeead60c5ad59c986b9db67b537d7b0b117ee9c134 /drivers/char/tpm/tpm_of.c
parent02ae1382882f08c5804b996ca9c8d79b399dbe36 (diff)
downloadop-kernel-dev-ed4fdb4f5dc758e9d5bfb5582c701b08a87115a6.zip
op-kernel-dev-ed4fdb4f5dc758e9d5bfb5582c701b08a87115a6.tar.gz
tpm: replace of_find_node_by_name() with dev of_node property
Using the device of_node property is a better way to refer to the device tree node rather than of_find_node_by_name(). Suggested-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Signed-off-by: Nayna Jain <nayna@linux.vnet.ibm.com> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Diffstat (limited to 'drivers/char/tpm/tpm_of.c')
-rw-r--r--drivers/char/tpm/tpm_of.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/char/tpm/tpm_of.c b/drivers/char/tpm/tpm_of.c
index 83c26bf..12a86dd 100644
--- a/drivers/char/tpm/tpm_of.c
+++ b/drivers/char/tpm/tpm_of.c
@@ -29,7 +29,8 @@ int tpm_read_log_of(struct tpm_chip *chip)
struct tpm_bios_log *log;
log = &chip->log;
- np = of_find_node_by_name(NULL, "vtpm");
+ if (chip->dev.parent->of_node)
+ np = chip->dev.parent->of_node;
if (!np) {
pr_err("%s: ERROR - IBMVTPM not supported\n", __func__);
return -ENODEV;
@@ -55,18 +56,15 @@ int tpm_read_log_of(struct tpm_chip *chip)
if (!log->bios_event_log) {
pr_err("%s: ERROR - Not enough memory for BIOS measurements\n",
__func__);
- of_node_put(np);
return -ENOMEM;
}
log->bios_event_log_end = log->bios_event_log + *sizep;
memcpy(log->bios_event_log, __va(*basep), *sizep);
- of_node_put(np);
return 0;
cleanup_eio:
- of_node_put(np);
return -EIO;
}
OpenPOWER on IntegriCloud