Skip to content

Commit 83b1bfb

Browse files
rubinigregkh
authored andcommitted
FMC: show_sdb_tree: fix offset calculation
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 <[email protected]> Reported-by: Juan David Gonzalez Cobas <[email protected]> Tested-by: Juan David Gonzalez Cobas <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent e4d6c4b commit 83b1bfb

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/fmc/fmc-sdb.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,20 +153,17 @@ EXPORT_SYMBOL(fmc_reprogram);
153153
static void __fmc_show_sdb_tree(const struct fmc_device *fmc,
154154
const struct sdb_array *arr)
155155
{
156+
unsigned long base = arr->baseaddr;
156157
int i, j, n = arr->len, level = arr->level;
157-
const struct sdb_array *ap;
158158

159159
for (i = 0; i < n; i++) {
160-
unsigned long base;
161160
union sdb_record *r;
162161
struct sdb_product *p;
163162
struct sdb_component *c;
164163
r = &arr->record[i];
165164
c = &r->dev.sdb_component;
166165
p = &c->product;
167-
base = 0;
168-
for (ap = arr; ap; ap = ap->parent)
169-
base += ap->baseaddr;
166+
170167
dev_info(&fmc->dev, "SDB: ");
171168

172169
for (j = 0; j < level; j++)

0 commit comments

Comments
 (0)