[PATCH -next 2/3] staging/fwserial: Use WARN_ONCE when port table is corrupted

2012-11-27 Thread Peter Hurley

Signed-off-by: Peter Hurley 
---
 drivers/staging/fwserial/fwserial.c | 11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/fwserial/fwserial.c 
b/drivers/staging/fwserial/fwserial.c
index 99a2d2d..0681967 100644
--- a/drivers/staging/fwserial/fwserial.c
+++ b/drivers/staging/fwserial/fwserial.c
@@ -939,14 +939,9 @@ static void fwserial_destroy(struct kref *kref)
 
mutex_lock(_table_lock);
for (j = 0; j < num_ports; ++i, ++j) {
-   static bool once;
-   int corrupt = port_table[i] != ports[j];
-   if (corrupt && !once) {
-   WARN(corrupt, "port_table[%d]: %p != ports[%d]: %p",
-i, port_table[i], j, ports[j]);
-   once = true;
-   port_table_corrupt = true;
-   }
+   port_table_corrupt |= port_table[i] != ports[j];
+   WARN_ONCE(port_table_corrupt, "port_table[%d]: %p != ports[%d]: 
%p",
+i, port_table[i], j, ports[j]);
 
port_table[i] = NULL;
}
-- 
1.8.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH -next 2/3] staging/fwserial: Use WARN_ONCE when port table is corrupted

2012-11-27 Thread Peter Hurley

Signed-off-by: Peter Hurley pe...@hurleysoftware.com
---
 drivers/staging/fwserial/fwserial.c | 11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/fwserial/fwserial.c 
b/drivers/staging/fwserial/fwserial.c
index 99a2d2d..0681967 100644
--- a/drivers/staging/fwserial/fwserial.c
+++ b/drivers/staging/fwserial/fwserial.c
@@ -939,14 +939,9 @@ static void fwserial_destroy(struct kref *kref)
 
mutex_lock(port_table_lock);
for (j = 0; j  num_ports; ++i, ++j) {
-   static bool once;
-   int corrupt = port_table[i] != ports[j];
-   if (corrupt  !once) {
-   WARN(corrupt, port_table[%d]: %p != ports[%d]: %p,
-i, port_table[i], j, ports[j]);
-   once = true;
-   port_table_corrupt = true;
-   }
+   port_table_corrupt |= port_table[i] != ports[j];
+   WARN_ONCE(port_table_corrupt, port_table[%d]: %p != ports[%d]: 
%p,
+i, port_table[i], j, ports[j]);
 
port_table[i] = NULL;
}
-- 
1.8.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/