lkml.org 
[lkml]   [2018]   [Feb]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/2 v5] tpm: cmd_ready command can be issued only after granting locality
From
Date
On Sun, 2018-02-25 at 14:00 +0200, Tomas Winkler wrote:
> if (need_locality && chip->ops->relinquish_locality) {
> - chip->ops->relinquish_locality(chip, chip->locality);
> + /* this coud be on error path, don't override error code */
> + int l_rc = chip->ops->relinquish_locality(chip, chip-
> >locality);
> +
> + if (l_rc)
> + dev_err(&chip->dev, "%s: relinquish_locality: error
> %d\n",
> + __func__, l_rc);
> +
> chip->locality = -1;
> }

The 'l_rc' declaration causes NAK as I've stated before.

Why don't you just make a helper function:

static void tpm_relinquish_locality(struct tpm_chip *chip)
{
int rc;

if (!chip->ops->relinquish_locality)
return 0;

rc = chip->ops->relinquish_locality(chip);
if (rc)
dev_err(&chip->dev, "%s: error %d\n", __func__, rc);

chip->locality = -1;
}

Then the original code would be simply:

if (need_locality)
tpm_relinquish_locality(chip);

/Jarkko

\
 
 \ /
  Last update: 2018-02-26 13:10    [W:1.580 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site