Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a0e39349 authored by Mimi Zohar's avatar Mimi Zohar Committed by James Morris
Browse files

tpm: add module_put wrapper



For readability, define a tpm_chip_put() wrapper to call module_put().
Replace existing module_put() calls with the wrapper.

(Change based on trusted/encrypted patchset review by David Howells.)

Signed-off-by: default avatarMimi Zohar <zohar@us.ibm.com>
Signed-off-by: default avatarDavid Safford <safford@watson.ibm.com>
Acked-by: default avatarDavid Howells <dhowells@redhat.com>
Acked-by: default avatarSerge E. Hallyn <serge.hallyn@canonical.com>
Signed-off-by: default avatarJames Morris <jmorris@namei.org>
parent dc88e460
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -736,7 +736,7 @@ int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf)
	if (chip == NULL)
	if (chip == NULL)
		return -ENODEV;
		return -ENODEV;
	rc = __tpm_pcr_read(chip, pcr_idx, res_buf);
	rc = __tpm_pcr_read(chip, pcr_idx, res_buf);
	module_put(chip->dev->driver->owner);
	tpm_chip_put(chip);
	return rc;
	return rc;
}
}
EXPORT_SYMBOL_GPL(tpm_pcr_read);
EXPORT_SYMBOL_GPL(tpm_pcr_read);
@@ -775,7 +775,7 @@ int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash)
	rc = transmit_cmd(chip, &cmd, EXTEND_PCR_RESULT_SIZE,
	rc = transmit_cmd(chip, &cmd, EXTEND_PCR_RESULT_SIZE,
			  "attempting extend a PCR value");
			  "attempting extend a PCR value");


	module_put(chip->dev->driver->owner);
	tpm_chip_put(chip);
	return rc;
	return rc;
}
}
EXPORT_SYMBOL_GPL(tpm_pcr_extend);
EXPORT_SYMBOL_GPL(tpm_pcr_extend);
+5 −0
Original line number Original line Diff line number Diff line
@@ -113,6 +113,11 @@ struct tpm_chip {


#define to_tpm_chip(n) container_of(n, struct tpm_chip, vendor)
#define to_tpm_chip(n) container_of(n, struct tpm_chip, vendor)


static inline void tpm_chip_put(struct tpm_chip *chip)
{
	module_put(chip->dev->driver->owner);
}

static inline int tpm_read_index(int base, int index)
static inline int tpm_read_index(int base, int index)
{
{
	outb(index, base);
	outb(index, base);