diff mbox series

xen/char: mvebu-uart: Fix MISRA C 2012 Rule 20.7 violation

Message ID 20220803070958.1752256-1-burzalodowa@gmail.com (mailing list archive)
State New, archived
Headers show
Series xen/char: mvebu-uart: Fix MISRA C 2012 Rule 20.7 violation | expand

Commit Message

Xenia Ragiadakou Aug. 3, 2022, 7:09 a.m. UTC
The macro parameters 'off' and 'uart' are used as expressions and it is
good to be enclosed in parentheses to prevent against unintended expansion.

For the 'uart' case, in mvebu3700_write(), correct the second parentheses
that seems to have been accidently misplaced.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
---
 xen/drivers/char/mvebu-uart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Stefano Stabellini Aug. 3, 2022, 9:22 p.m. UTC | #1
On Wed, 3 Aug 2022, Xenia Ragiadakou wrote:
> The macro parameters 'off' and 'uart' are used as expressions and it is
> good to be enclosed in parentheses to prevent against unintended expansion.
> 
> For the 'uart' case, in mvebu3700_write(), correct the second parentheses
> that seems to have been accidently misplaced.
> 
> Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
>  xen/drivers/char/mvebu-uart.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/drivers/char/mvebu-uart.c b/xen/drivers/char/mvebu-uart.c
> index 835d1ace3c..a00618b96f 100644
> --- a/xen/drivers/char/mvebu-uart.c
> +++ b/xen/drivers/char/mvebu-uart.c
> @@ -64,8 +64,8 @@ static struct mvebu3700_uart {
>      struct vuart_info vuart;
>  } mvebu3700_com = {0};
>  
> -#define mvebu3700_read(uart, off)           readl((uart)->regs + off)
> -#define mvebu3700_write(uart, off, val)     writel(val, (uart->regs) + off)
> +#define mvebu3700_read(uart, off)           readl((uart)->regs + (off))
> +#define mvebu3700_write(uart, off, val)     writel(val, (uart)->regs + (off))
>  
>  static void mvebu3700_uart_interrupt(int irq, void *data,
>                                       struct cpu_user_regs *regs)
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/xen/drivers/char/mvebu-uart.c b/xen/drivers/char/mvebu-uart.c
index 835d1ace3c..a00618b96f 100644
--- a/xen/drivers/char/mvebu-uart.c
+++ b/xen/drivers/char/mvebu-uart.c
@@ -64,8 +64,8 @@  static struct mvebu3700_uart {
     struct vuart_info vuart;
 } mvebu3700_com = {0};
 
-#define mvebu3700_read(uart, off)           readl((uart)->regs + off)
-#define mvebu3700_write(uart, off, val)     writel(val, (uart->regs) + off)
+#define mvebu3700_read(uart, off)           readl((uart)->regs + (off))
+#define mvebu3700_write(uart, off, val)     writel(val, (uart)->regs + (off))
 
 static void mvebu3700_uart_interrupt(int irq, void *data,
                                      struct cpu_user_regs *regs)