|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] extras/mini-os/tpmback.c: fix compilation error.
commit c30018c884b7285465a27f960c6068ea7373a5db
Author: Dushyant Behl <myselfdushyantbehl@xxxxxxxxx>
AuthorDate: Mon Jul 21 02:22:59 2014 +0530
Commit: Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Mon Jul 21 12:10:46 2014 +0100
extras/mini-os/tpmback.c: fix compilation error.
This patch is with respect to the following discussion on xen-devel -
http://lists.xenproject.org/archives/html/xen-devel/2014-07/msg01991.html
The file extras/mini-os/tpmback.c was failing compilation on certain
compilers
because of size mismatch between enum and int. Earlier the code used to read
value of enum using %d format, which failed compilation on some compilers:
tpmback.c: In function â??tpmif_change_stateâ??:
tpmback.c:350:4: error: format â??%dâ?? expects argument of type â??int
*â??,
but argument 3 has type â??enum xenbus_state *â?? [-Werror=format=]
if(sscanf(value, "%d", &readst) != 1) {
^
Now the value is read into an actual int variable and then assigned to the
enum.
Signed-off-by:- Dushyant Behl <myselfdushyantbehl@xxxxxxxxx>
Acked-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
[ ijc -- added the actual error to the commit log ]
---
extras/mini-os/tpmback.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/extras/mini-os/tpmback.c b/extras/mini-os/tpmback.c
index 0601eb3..31da8d5 100644
--- a/extras/mini-os/tpmback.c
+++ b/extras/mini-os/tpmback.c
@@ -332,6 +332,7 @@ error_post_irq:
* returns 0 on success and non-zero on error */
int tpmif_change_state(tpmif_t* tpmif, enum xenbus_state state)
{
+ int tempst;
char path[512];
char *value;
char *err;
@@ -347,11 +348,12 @@ int tpmif_change_state(tpmif_t* tpmif, enum xenbus_state
state)
free(err);
return -1;
}
- if(sscanf(value, "%d", &readst) != 1) {
+ if(sscanf(value, "%d", &tempst) != 1) {
TPMBACK_ERR("Non integer value (%s) in %s ??\n", value, path);
free(value);
return -1;
}
+ readst = (enum xenbus_state) tempst;
free(value);
/* It's possible that the backend state got updated by hotplug or something
else behind our back */
--
generated by git-patchbot for /home/xen/git/xen.git#master
_______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |