mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
xen: make use of xenbus_read_unsigned() in xen-tpmfront
Use xenbus_read_unsigned() instead of xenbus_scanf() when possible. This requires to change the type of one read from int to unsigned, but this case has been wrong before: negative values are not allowed for the modified case. Cc: peterhuewe@gmx.de Cc: tpmdd@selhorst.net Cc: jarkko.sakkinen@linux.intel.com Cc: jgunthorpe@obsidianresearch.com Cc: tpmdd-devel@lists.sourceforge.net Signed-off-by: Juergen Gross <jgross@suse.com> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Acked-by: David Vrabel <david.vrabel@citrix.com>
This commit is contained in:
parent
f27dc1ac56
commit
0240933469
1 changed files with 2 additions and 6 deletions
|
@ -337,18 +337,14 @@ static int tpmfront_resume(struct xenbus_device *dev)
|
||||||
static void backend_changed(struct xenbus_device *dev,
|
static void backend_changed(struct xenbus_device *dev,
|
||||||
enum xenbus_state backend_state)
|
enum xenbus_state backend_state)
|
||||||
{
|
{
|
||||||
int val;
|
|
||||||
|
|
||||||
switch (backend_state) {
|
switch (backend_state) {
|
||||||
case XenbusStateInitialised:
|
case XenbusStateInitialised:
|
||||||
case XenbusStateConnected:
|
case XenbusStateConnected:
|
||||||
if (dev->state == XenbusStateConnected)
|
if (dev->state == XenbusStateConnected)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (xenbus_scanf(XBT_NIL, dev->otherend,
|
if (!xenbus_read_unsigned(dev->otherend, "feature-protocol-v2",
|
||||||
"feature-protocol-v2", "%d", &val) < 0)
|
0)) {
|
||||||
val = 0;
|
|
||||||
if (!val) {
|
|
||||||
xenbus_dev_fatal(dev, -EINVAL,
|
xenbus_dev_fatal(dev, -EINVAL,
|
||||||
"vTPM protocol 2 required");
|
"vTPM protocol 2 required");
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue