]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
FMC: show_sdb_tree: fix offset calculation
authorAlessandro Rubini <rubini@gnudd.com>
Thu, 30 Jan 2014 12:05:20 +0000 (13:05 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 15 Feb 2014 19:51:04 +0000 (11:51 -0800)
The code reported wrong addresses in the sdb dumps.  All sdb addresses
are relative, but the code was adding the base address twice.  Bug
exposed by a gateware image with two bridge levels.

Thanks David for reporting the problem.

Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
Reported-by: Juan David Gonzalez Cobas <dcobas@cern.ch>
Tested-by: Juan David Gonzalez Cobas <dcobas@cern.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/fmc/fmc-sdb.c

index 79adc39221ea745f1a403a9eb6b1434f9cb20618..69f42d70bc74f9ac29fedd74d3ad3ba62c8cc612 100644 (file)
@@ -153,20 +153,17 @@ EXPORT_SYMBOL(fmc_reprogram);
 static void __fmc_show_sdb_tree(const struct fmc_device *fmc,
                                const struct sdb_array *arr)
 {
+       unsigned long base = arr->baseaddr;
        int i, j, n = arr->len, level = arr->level;
-       const struct sdb_array *ap;
 
        for (i = 0; i < n; i++) {
-               unsigned long base;
                union  sdb_record *r;
                struct sdb_product *p;
                struct sdb_component *c;
                r = &arr->record[i];
                c = &r->dev.sdb_component;
                p = &c->product;
-               base = 0;
-               for (ap = arr; ap; ap = ap->parent)
-                       base += ap->baseaddr;
+
                dev_info(&fmc->dev, "SDB: ");
 
                for (j = 0; j < level; j++)