aboutsummaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
authorManuel Lauss <manuel.lauss@gmail.com>2017-06-19 08:27:17 +0200
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>2017-07-03 16:10:12 +0300
commitd4939e16ea9ba507670d7597765f438cd6bee97b (patch)
treef0ae73e22981262855f0e25c3639c6cd86ce560f /drivers/char
parent3d53fb563c0f7a6b4606e66c17025589aaa81723 (diff)
tpm/tpm_crb: fix priv->cmd_size initialisation
priv->cmd_size is never initialised if the cmd and rsp buffers reside at different addresses. Initialise it in the exit path of the function when rsp buffer has also been successfully allocated. Fixes: aa77ea0e43dc ("tpm/tpm_crb: cache cmd_size register value."). Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/tpm/tpm_crb.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c
index b917b9d5f710..c3989b090c5b 100644
--- a/drivers/char/tpm/tpm_crb.c
+++ b/drivers/char/tpm/tpm_crb.c
@@ -515,11 +515,12 @@ static int crb_map_io(struct acpi_device *device, struct crb_priv *priv,
goto out;
}
- priv->cmd_size = cmd_size;
-
priv->rsp = priv->cmd;
out:
+ if (!ret)
+ priv->cmd_size = cmd_size;
+
crb_go_idle(dev, priv);
return ret;