lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190222203159.15116-4-barbara.fernandes@usp.br>
Date:   Fri, 22 Feb 2019 17:31:58 -0300
From:   Bárbara Fernandes <barbara.fernandes@....br>
To:     Lars-Peter Clausen <lars@...afoo.de>,
        Michael Hennerich <Michael.Hennerich@...log.com>,
        Jonathan Cameron <jic23@...nel.org>,
        Hartmut Knaack <knaack.h@....de>,
        Peter Meerwald-Stadler <pmeerw@...erw.net>
Cc:     linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
        kernel-usp@...glegroups.com,
        Bárbara Fernandes <barbara.fernandes@....br>
Subject: [PATCH 3/4] iio:adc:ad7923: Put macro argument between ()'s

Put macro argument between parenthesis in order to avoid precedence
issues. Solves the following checkpath.pl's messages:

CHECK: Macro argument 'mode' may be better as '(mode)' to avoid
precedence issues
CHECK: Macro argument 'channel' may be better as '(channel)' to
avoid precedence issues
CHECK: Macro argument reuse 'sequence' - possible side-effects?
CHECK: Macro argument 'sequence' may be better as '(sequence)' to
avoid precedence issues
CHECK: Macro argument 'val' may be better as '(val)' to avoid
precedence issues
CHECK: Macro argument 'dec' may be better as '(dec)' to avoid precedence
issues
CHECK: Macro argument 'bits' may be better as '(bits)' to avoid
precedence issues

Signed-off-by: Bárbara Fernandes <barbara.fernandes@....br>
---
 drivers/iio/adc/ad7923.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/adc/ad7923.c b/drivers/iio/adc/ad7923.c
index b39ea834cdd6..dbece44e26e4 100644
--- a/drivers/iio/adc/ad7923.c
+++ b/drivers/iio/adc/ad7923.c
@@ -40,16 +40,16 @@
 
 #define AD7923_MAX_CHAN		4
 
-#define AD7923_PM_MODE_WRITE(mode)	(mode << 4)	/* write mode */
-#define AD7923_CHANNEL_WRITE(channel)	(channel << 6)	/* write channel */
-#define AD7923_SEQUENCE_WRITE(sequence)	(((sequence & 1) << 3) \
-					+ ((sequence & 2) << 9))
+#define AD7923_PM_MODE_WRITE(mode)	((mode) << 4)	 /* write mode */
+#define AD7923_CHANNEL_WRITE(channel)	((channel) << 6) /* write channel */
+#define AD7923_SEQUENCE_WRITE(sequence)	((((sequence) & 1) << 3) \
+					+ (((sequence) & 2) << 9))
 						/* write sequence fonction */
 /* left shift for CR : bit 11 transmit in first */
 #define AD7923_SHIFT_REGISTER	4
 
 /* val = value, dec = left shift, bits = number of bits of the mask */
-#define EXTRACT(val, dec, bits)		((val >> dec) & ((1 << bits) - 1))
+#define EXTRACT(val, dec, bits)		(((val) >> (dec)) & ((1 << (bits)) - 1))
 
 struct ad7923_state {
 	struct spi_device		*spi;
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ