[flashrom] [commit] r1359 - trunk

repository service svn at flashrom.org
Fri Jul 1 02:39:02 CEST 2011


Author: stefanct
Date: Fri Jul  1 02:39:01 2011
New Revision: 1359
URL: http://flashrom.org/trac/flashrom/changeset/1359

Log:
ichspi.c: make REGWRITE* macros safer

'+' does have a quite high precedence so "calling" those macros with a
term including weaker operators in the off parameter may have unexpected
consequences.

Signed-off-by: Stefan Tauner <stefan.tauner at student.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>

Modified:
   trunk/ichspi.c

Modified: trunk/ichspi.c
==============================================================================
--- trunk/ichspi.c	Fri Jul  1 02:19:12 2011	(r1358)
+++ trunk/ichspi.c	Fri Jul  1 02:39:01 2011	(r1359)
@@ -216,9 +216,9 @@
 	return mmio_readb(ich_spibar + X);
 }
 
-#define REGWRITE32(off,val) mmio_writel(val, ich_spibar+off)
-#define REGWRITE16(off,val) mmio_writew(val, ich_spibar+off)
-#define REGWRITE8(off,val)  mmio_writeb(val, ich_spibar+off)
+#define REGWRITE32(off, val) mmio_writel(val, ich_spibar+(off))
+#define REGWRITE16(off, val) mmio_writew(val, ich_spibar+(off))
+#define REGWRITE8(off, val)  mmio_writeb(val, ich_spibar+(off))
 
 /* Common SPI functions */
 static int find_opcode(OPCODES *op, uint8_t opcode);




More information about the flashrom mailing list