From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46318) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akRWJ-0002db-J8 for qemu-devel@nongnu.org; Mon, 28 Mar 2016 03:23:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1akRWE-0003hx-PD for qemu-devel@nongnu.org; Mon, 28 Mar 2016 03:23:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38112) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akRWE-0003hr-Jz for qemu-devel@nongnu.org; Mon, 28 Mar 2016 03:23:22 -0400 From: Marcel Apfelbaum Date: Mon, 28 Mar 2016 10:23:17 +0300 Message-Id: <1459149797-24108-1-git-send-email-marcel@redhat.com> Subject: [Qemu-devel] [PATCH] pci: fix compilation warnings List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: marcel@redhat.com, peter.maydell@linaro.org, armbru@redhat.com, mst@redhat.com Fix 'error: shift exponent -1 is negative' warning by adding a corresponding assert. Reported-by: Peter Maydell Signed-off-by: Markus Armbruster Signed-off-by: Marcel Apfelbaum --- hw/pci/pci.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index e67664d..a1d41aa 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -163,11 +163,15 @@ int pci_bar(PCIDevice *d, int reg) static inline int pci_irq_state(PCIDevice *d, int irq_num) { + assert(irq_num >= 0); + return (d->irq_state >> irq_num) & 0x1; } static inline void pci_set_irq_state(PCIDevice *d, int irq_num, int level) { + assert(irq_num >= 0); + d->irq_state &= ~(0x1 << irq_num); d->irq_state |= level << irq_num; } -- 2.4.3