[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] xen/char: imx-lpuart: Fix MISRA C 2012 Rule 20.7 violation



Hi Jan,

On 8/2/22 14:58, Jan Beulich wrote:
On 02.08.2022 09:54, Xenia Ragiadakou wrote:
--- a/xen/drivers/char/imx-lpuart.c
+++ b/xen/drivers/char/imx-lpuart.c
@@ -26,8 +26,8 @@
  #include <asm/imx-lpuart.h>
  #include <asm/io.h>
-#define imx_lpuart_read(uart, off) readl((uart)->regs + off)
-#define imx_lpuart_write(uart, off, val) writel((val), (uart)->regs + off)
+#define imx_lpuart_read(uart, off)       readl((uart)->regs + (off))
+#define imx_lpuart_write(uart, off, val) writel((val), (uart)->regs + (off))

As elsewhere before I think at the same time you want to drop the
parentheses from the single use of "val".


In general I do not want to include irrelevant changes in my patches.
Also, here, I do not want to drop the parentheses from val because the removal of the parentheses
- consists a violation of the rule 20.7
- would allow the following to compile
#define VAL x, y, z);(
imx_lpuart_write(uart, off, VAL)
- is not justifiable (i.e does not fix a bug, does not result in more readable code etc)

I understand that the rest of the community does not agree with adding parentheses around macro parameters used as function arguments and as the right-side operand of the assignment operator, but I consider them useful and I do not want to remove them myself. Maybe somebody else from the community could do that.

Also, these exceptions would be good to be mentioned in the rules.rst. So, that other contributors do not try to fix relevant warnings.

--
Xenia



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.