tpm: Only call pm_runtime_get_sync if device has a parent
PATCH 1/1 tpm: Only call pm_runtime_get_sync if device has a parent
Only call pm_runtime_get_sync if the device has a parent. This change fixes a crash in the tpm_vtpm_proxy driver since that driver does not have a parent device.
--- drivers/char/tpm/tpm-interface.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/char/tpm/tpm-interface.c +4 -2
@@ -357,7 +357,8 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const u8 *buf, size_t bufsiz,if (!(flags &TPM_TRANSMIT_UNLOCKED ))mutex_lock (&chip->tpm_mutex); -pm_runtime_get_sync (chip->dev.parent); +if (chip->dev.parent) +pm_runtime_get_sync (chip->dev.parent); rc = chip->ops->send (chip, (u8 *) buf, count);if (rc <0 ) {
@@ -400,7 +401,8 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const u8 *buf, size_t bufsiz,dev_err (&chip->dev,"tpm_transmit: tpm_recv: error %zd\n" , rc); out: -pm_runtime_put_sync (chip->dev.parent); +if (chip->dev.parent) +pm_runtime_put_sync (chip->dev.parent);if (!(flags &TPM_TRANSMIT_UNLOCKED ))mutex_unlock (&chip->tpm_mutex);
Signature · 9 lines
2.4.3 ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi
A message that is not in the archive (sent off-list or not yet received): 1478520873-30564-1-git-send-email-stefanb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org
Jarkko Sakkinen
Reviewed-byQuoted 5 lines · Stefan Berger
Only call
pm_runtime_get_syncif the device has a parent. This change fixes a crash in thetpm_vtpm_proxydriver since that driver does not have a parent device.Signed-off-by Stefan Berger <[email protected]>
/Jarkko
Quoted 31 lines
--- drivers/char/tpm/tpm-interface.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/char/tpm/tpm-interface.c +4
-2@@ -357,7 +357,8 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const u8 *buf, size_t bufsiz,if (!(flags &TPM_TRANSMIT_UNLOCKED ))mutex_lock (&chip->tpm_mutex); -pm_runtime_get_sync (chip->dev.parent); +if (chip->dev.parent) +pm_runtime_get_sync (chip->dev.parent); rc = chip->ops->send (chip, (u8 *) buf, count);if (rc <0 ) {@@ -400,7 +401,8 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const u8 *buf, size_t bufsiz,dev_err (&chip->dev,"tpm_transmit: tpm_recv: error %zd\n" , rc); out: -pm_runtime_put_sync (chip->dev.parent); +if (chip->dev.parent) +pm_runtime_put_sync (chip->dev.parent);if (!(flags &TPM_TRANSMIT_UNLOCKED ))mutex_unlock (&chip->tpm_mutex);Signature · 1 line
2.4.3
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
Jarkko Sakkinen
AppliedQuoted 5 lines · Stefan Berger
Only call
pm_runtime_get_syncif the device has a parent. This change fixes a crash in thetpm_vtpm_proxydriver since that driver does not have a parent device.Signed-off-by Stefan Berger <[email protected]>
Applied.
/Jarkko
Quoted 31 lines
--- drivers/char/tpm/tpm-interface.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/char/tpm/tpm-interface.c +4
-2@@ -357,7 +357,8 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const u8 *buf, size_t bufsiz,if (!(flags &TPM_TRANSMIT_UNLOCKED ))mutex_lock (&chip->tpm_mutex); -pm_runtime_get_sync (chip->dev.parent); +if (chip->dev.parent) +pm_runtime_get_sync (chip->dev.parent); rc = chip->ops->send (chip, (u8 *) buf, count);if (rc <0 ) {@@ -400,7 +401,8 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const u8 *buf, size_t bufsiz,dev_err (&chip->dev,"tpm_transmit: tpm_recv: error %zd\n" , rc); out: -pm_runtime_put_sync (chip->dev.parent); +if (chip->dev.parent) +pm_runtime_put_sync (chip->dev.parent);if (!(flags &TPM_TRANSMIT_UNLOCKED ))mutex_unlock (&chip->tpm_mutex);Signature · 1 line
2.4.3
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi