[SeaBIOS] [PATCH v3 9/9] usb-ohci: Fix logical condition in start_ohci function

Jiaxun Yang posted 9 patches 5 months ago
[SeaBIOS] [PATCH v3 9/9] usb-ohci: Fix logical condition in start_ohci function
Posted by Jiaxun Yang 5 months ago
Correct the logical condition in the start_ohci function to ensure
proper evaluation of the status variable.

Fix warning:

./src/hw/usb-ohci.c:192:13: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]
  192 |         if (! status & OHCI_HCR)

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 src/hw/usb-ohci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/hw/usb-ohci.c b/src/hw/usb-ohci.c
index 90f60e6452957552412d2aa9958f00141473437a..0fe8ea9e5d36468516e608305104da1e2129be70 100644
--- a/src/hw/usb-ohci.c
+++ b/src/hw/usb-ohci.c
@@ -189,7 +189,7 @@ start_ohci(struct usb_ohci_s *cntl, struct ohci_hcca *hcca)
     writel(&cntl->regs->cmdstatus, OHCI_HCR);
     for (;;) {
         u32 status = readl(&cntl->regs->cmdstatus);
-        if (! status & OHCI_HCR)
+        if (!(status & OHCI_HCR))
             break;
         if (timer_check(end)) {
             warn_timeout();

-- 
2.43.0

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: [PATCH v3 9/9] usb-ohci: Fix logical condition in start_ohci function
Posted by Gerd Hoffmann via SeaBIOS 3 weeks, 4 days ago
On Tue, Sep 09, 2025 at 04:18:02AM +0000, Jiaxun Yang wrote:
> Correct the logical condition in the start_ohci function to ensure
> proper evaluation of the status variable.
> 
> Fix warning:
> 
> ./src/hw/usb-ohci.c:192:13: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]
>   192 |         if (! status & OHCI_HCR)
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>

Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org