Commit ed4fdb4f authored by Nayna Jain's avatar Nayna Jain Committed by Jarkko Sakkinen

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: default avatarJason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: default avatarNayna Jain <nayna@linux.vnet.ibm.com>
Reviewed-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
parent 02ae1382
...@@ -29,7 +29,8 @@ int tpm_read_log_of(struct tpm_chip *chip) ...@@ -29,7 +29,8 @@ int tpm_read_log_of(struct tpm_chip *chip)
struct tpm_bios_log *log; struct tpm_bios_log *log;
log = &chip->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) { if (!np) {
pr_err("%s: ERROR - IBMVTPM not supported\n", __func__); pr_err("%s: ERROR - IBMVTPM not supported\n", __func__);
return -ENODEV; return -ENODEV;
...@@ -55,18 +56,15 @@ int tpm_read_log_of(struct tpm_chip *chip) ...@@ -55,18 +56,15 @@ int tpm_read_log_of(struct tpm_chip *chip)
if (!log->bios_event_log) { if (!log->bios_event_log) {
pr_err("%s: ERROR - Not enough memory for BIOS measurements\n", pr_err("%s: ERROR - Not enough memory for BIOS measurements\n",
__func__); __func__);
of_node_put(np);
return -ENOMEM; return -ENOMEM;
} }
log->bios_event_log_end = log->bios_event_log + *sizep; log->bios_event_log_end = log->bios_event_log + *sizep;
memcpy(log->bios_event_log, __va(*basep), *sizep); memcpy(log->bios_event_log, __va(*basep), *sizep);
of_node_put(np);
return 0; return 0;
cleanup_eio: cleanup_eio:
of_node_put(np);
return -EIO; return -EIO;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment