xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Dushyant Behl <myselfdushyantbehl@gmail.com>
To: "\"Xen Devel" <xen-devel@lists.xen.org>
Cc: Ian Campbell <Ian.Campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Samuel Thibault <samuel.thibault@ens-lyon.org>,
	Daniel De Graaf <dgdegra@tycho.nsa.gov>,
	Dushyant Behl <myselfdushyantbehl@gmail.com>
Subject: [PATCH] extras/mini-os/tpmback.c : fix compilation error.
Date: Mon, 21 Jul 2014 02:22:59 +0530	[thread overview]
Message-ID: <1405889579-14705-1-git-send-email-myselfdushyantbehl@gmail.com> (raw)

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.
Now the value is read into an actual int variable and then assigned to the enum.

Signed-off-by:- Dushyant Behl <myselfdushyantbehl@gmail.com>
---
 extras/mini-os/tpmback.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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 */
-- 
1.9.1

             reply	other threads:[~2014-07-20 20:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-20 20:52 Dushyant Behl [this message]
2014-07-20 21:02 ` [PATCH] extras/mini-os/tpmback.c : fix compilation error Samuel Thibault
2014-07-21 11:43   ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1405889579-14705-1-git-send-email-myselfdushyantbehl@gmail.com \
    --to=myselfdushyantbehl@gmail.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=samuel.thibault@ens-lyon.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).