]> git.karo-electronics.de Git - linux-beck.git/commitdiff
vme: tsi148: Only store VME bus errors if they will be checked
authorMartyn Welch <martyn.welch@ge.com>
Tue, 11 Jun 2013 10:20:17 +0000 (11:20 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Jun 2013 23:41:50 +0000 (16:41 -0700)
The TSI148 driver provides an optional mechanism for ensuring that errors
resulting from posted transfers are caught whilst still relevant. To do this
errors are stored in a link list. If bus errors are not checked, this list
would grow until available memory had been exhausted.

Only store the errors in a link list if error detection is switched on.

Reported-by: De Roo, Steven <steven.deroo@arcelormittal.com>
Signed-off-by: Martyn Welch <martyn.welch@ge.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/vme/bridges/vme_tsi148.c

index 9c1aa4dc39c9051e95c9e1407d9ec335735bb1d8..94ce64d7a5f6a6c46a2a1bff0102744e07fca437 100644 (file)
@@ -169,7 +169,7 @@ static u32 tsi148_VERR_irqhandler(struct vme_bridge *tsi148_bridge)
        unsigned int error_addr_high, error_addr_low;
        unsigned long long error_addr;
        u32 error_attrib;
-       struct vme_bus_error *error;
+       struct vme_bus_error *error = NULL;
        struct tsi148_driver *bridge;
 
        bridge = tsi148_bridge->driver_priv;
@@ -186,16 +186,22 @@ static u32 tsi148_VERR_irqhandler(struct vme_bridge *tsi148_bridge)
                        "Occurred\n");
        }
 
-       error = kmalloc(sizeof(struct vme_bus_error), GFP_ATOMIC);
-       if (error) {
-               error->address = error_addr;
-               error->attributes = error_attrib;
-               list_add_tail(&error->list, &tsi148_bridge->vme_errors);
-       } else {
-               dev_err(tsi148_bridge->parent, "Unable to alloc memory for "
-                       "VMEbus Error reporting\n");
-               dev_err(tsi148_bridge->parent, "VME Bus Error at address: "
-                       "0x%llx, attributes: %08x\n", error_addr, error_attrib);
+       if (err_chk) {
+               error = kmalloc(sizeof(struct vme_bus_error), GFP_ATOMIC);
+               if (error) {
+                       error->address = error_addr;
+                       error->attributes = error_attrib;
+                       list_add_tail(&error->list, &tsi148_bridge->vme_errors);
+               } else {
+                       dev_err(tsi148_bridge->parent,
+                               "Unable to alloc memory for VMEbus Error reporting\n");
+               }
+       }
+
+       if (!error) {
+               dev_err(tsi148_bridge->parent,
+                       "VME Bus Error at address: 0x%llx, attributes: %08x\n",
+                       error_addr, error_attrib);
        }
 
        /* Clear Status */