From: Stefan Weil <sw@weilnetz.de>
To: qemu-trivial@nongnu.org
Cc: Stefan Weil <sw@weilnetz.de>, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] hw/xics: Fix one-bit signed bitfields
Date: Tue, 4 Sep 2012 22:30:01 +0200 [thread overview]
Message-ID: <1346790601-14439-1-git-send-email-sw@weilnetz.de> (raw)
Report from smatch:
xics.c:169:19: error: dubious one-bit signed bitfield
xics.c:170:15: error: dubious one-bit signed bitfield
xics.c:171:19: error: dubious one-bit signed bitfield
xics.c:172:25: error: dubious one-bit signed bitfield
Instead of replacing 'int' by 'unsigned', 'bool' was used because
all 4 values are boolean values.
Replacing 0 and 1 in the assignments by false and true
looks better for those boolean values.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
hw/xics.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/hw/xics.c b/hw/xics.c
index b674771..8a2f70f 100644
--- a/hw/xics.c
+++ b/hw/xics.c
@@ -166,10 +166,10 @@ struct ics_irq_state {
uint8_t priority;
uint8_t saved_priority;
enum xics_irq_type type;
- int asserted:1;
- int sent:1;
- int rejected:1;
- int masked_pending:1;
+ bool asserted:1;
+ bool sent:1;
+ bool rejected:1;
+ bool masked_pending:1;
};
struct ics_state {
@@ -192,7 +192,7 @@ static void resend_msi(struct ics_state *ics, int srcno)
/* FIXME: filter by server#? */
if (irq->rejected) {
- irq->rejected = 0;
+ irq->rejected = false;
if (irq->priority != 0xff) {
icp_irq(ics->icp, irq->server, srcno + ics->offset,
irq->priority);
@@ -205,7 +205,7 @@ static void resend_lsi(struct ics_state *ics, int srcno)
struct ics_irq_state *irq = ics->irqs + srcno;
if ((irq->priority != 0xff) && irq->asserted && !irq->sent) {
- irq->sent = 1;
+ irq->sent = true;
icp_irq(ics->icp, irq->server, srcno + ics->offset, irq->priority);
}
}
@@ -216,7 +216,7 @@ static void set_irq_msi(struct ics_state *ics, int srcno, int val)
if (val) {
if (irq->priority == 0xff) {
- irq->masked_pending = 1;
+ irq->masked_pending = true;
/* masked pending */ ;
} else {
icp_irq(ics->icp, irq->server, srcno + ics->offset, irq->priority);
@@ -252,7 +252,7 @@ static void write_xive_msi(struct ics_state *ics, int srcno)
return;
}
- irq->masked_pending = 0;
+ irq->masked_pending = false;
icp_irq(ics->icp, irq->server, srcno + ics->offset, irq->priority);
}
@@ -281,8 +281,8 @@ static void ics_reject(struct ics_state *ics, int nr)
{
struct ics_irq_state *irq = ics->irqs + nr - ics->offset;
- irq->rejected = 1; /* Irrelevant but harmless for LSI */
- irq->sent = 0; /* Irrelevant but harmless for MSI */
+ irq->rejected = true; /* Irrelevant but harmless for LSI */
+ irq->sent = false; /* Irrelevant but harmless for MSI */
}
static void ics_resend(struct ics_state *ics)
@@ -307,7 +307,7 @@ static void ics_eoi(struct ics_state *ics, int nr)
struct ics_irq_state *irq = ics->irqs + srcno;
if (irq->type == XICS_LSI) {
- irq->sent = 0;
+ irq->sent = false;
}
}
--
1.7.10
next reply other threads:[~2012-09-04 20:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-04 20:30 Stefan Weil [this message]
2012-09-04 20:53 ` [Qemu-devel] [PATCH] hw/xics: Fix one-bit signed bitfields Peter Maydell
2012-09-22 21:34 ` Stefan Weil
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=1346790601-14439-1-git-send-email-sw@weilnetz.de \
--to=sw@weilnetz.de \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.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).