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

Jiaxun Yang posted 9 patches 2 weeks, 4 days ago
There is a newer version of this series
[SeaBIOS] [PATCH v2 9/9] usb-ohci: Fix logical condition in start_ohci function
Posted by Jiaxun Yang 2 weeks, 4 days ago
Corrected the logical condition in the start_ohci function to ensure proper evaluation of the status variable. This change prevents potential misinterpretation of the command status register.

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 v2 9/9] usb-ohci: Fix logical condition in start_ohci function
Posted by Paul Menzel 2 weeks, 4 days ago
Dear Jiaxin,


Thank you for your patch.


Am 03.09.25 um 08:51 schrieb Jiaxun Yang:
> Corrected the logical condition in the start_ohci function to ensure proper evaluation of the status variable. This change prevents potential misinterpretation of the command status register.

Same as in 8/9: Imperative mood and wrap the line.

> 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();
> 

Nice find.

Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>


Kind regards,

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