Skip to content

Commit

Permalink
tpm: replace of_find_node_by_name() with dev of_node property
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Nayna Jain authored and Jarkko Sakkinen committed Nov 27, 2016
1 parent 02ae138 commit ed4fdb4
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/char/tpm/tpm_of.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

0 comments on commit ed4fdb4

Please sign in to comment.