tpm: tpm_crb: relinquish locality on error path.

In crb_map_io() function, __crb_request_locality() is called prior
to crb_cmd_ready(), but if one of the consecutive function fails
the flow bails out instead of trying to relinquish locality.
This patch adds goto jump to __crb_relinquish_locality() on the error path.

Fixes: 888d867df4 (tpm: cmd_ready command can be issued only after granting locality)
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
This commit is contained in:
Winkler, Tomas 2018-04-07 19:12:36 +03:00 коммит произвёл Jarkko Sakkinen
Родитель c922ff8e58
Коммит 1fbad30286
1 изменённых файлов: 7 добавлений и 3 удалений

Просмотреть файл

@ -511,8 +511,10 @@ static int crb_map_io(struct acpi_device *device, struct crb_priv *priv,
priv->regs_t = crb_map_res(dev, priv, &io_res, buf->control_address, priv->regs_t = crb_map_res(dev, priv, &io_res, buf->control_address,
sizeof(struct crb_regs_tail)); sizeof(struct crb_regs_tail));
if (IS_ERR(priv->regs_t)) if (IS_ERR(priv->regs_t)) {
return PTR_ERR(priv->regs_t); ret = PTR_ERR(priv->regs_t);
goto out_relinquish_locality;
}
/* /*
* PTT HW bug w/a: wake up the device to access * PTT HW bug w/a: wake up the device to access
@ -520,7 +522,7 @@ static int crb_map_io(struct acpi_device *device, struct crb_priv *priv,
*/ */
ret = crb_cmd_ready(dev, priv); ret = crb_cmd_ready(dev, priv);
if (ret) if (ret)
return ret; goto out_relinquish_locality;
pa_high = ioread32(&priv->regs_t->ctrl_cmd_pa_high); pa_high = ioread32(&priv->regs_t->ctrl_cmd_pa_high);
pa_low = ioread32(&priv->regs_t->ctrl_cmd_pa_low); pa_low = ioread32(&priv->regs_t->ctrl_cmd_pa_low);
@ -565,6 +567,8 @@ out:
crb_go_idle(dev, priv); crb_go_idle(dev, priv);
out_relinquish_locality:
__crb_relinquish_locality(dev, priv, 0); __crb_relinquish_locality(dev, priv, 0);
return ret; return ret;