[PATCH 3/3] sandbox: work around missing of_add_memory_bank()

Holger Schurig holgerschurig at gmail.com
Tue Jul 22 03:25:39 PDT 2014


> but this doesn't explain a build failure

The build failure was

  LD      barebox
drivers/built-in.o: In function `of_add_memory':
/home/schurig/d/mkarm/barebox/drivers/of/base.c:1716: undefined
reference to `of_add_memory_bank'
collect2: error: ld returned 1 exit status
make: *** [barebox] Error 1

To be honest, I simply assumed "sandbox has no memory banks, so adding
them is futile" and commented them away. Two weeks ago (or so, not
exactly sure) there was talk on the same function here in the mailing
list. At that time there have been some other suggestions, but they
made the MIPS arch not build. Sascha then said he had no further idea.

> CONFIG_OFTREE_MEM_GENERIC to be enabled on sandbox. Would
> this work for you?

Yes, that worked. This now checks even more code than my #ifdeffery
would have checked, so I like it.

Would then this be ok?

--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -4,7 +4,7 @@ config OFTREE

 config OFTREE_MEM_GENERIC
        depends on OFTREE
-       depends on PPC || ARM || ARCH_EFI
+       depends on PPC || ARM || ARCH_EFI || SANDBOX
        def_bool y



Unrelated: which static checkers use you in non-kernel project?  I
know sparse, but that isn't really usable outisde the kernel, or is
it?

I found clang's static checker giving out lots of warning, similar to
-Wall -Weverything, e.g. he spits out things that aren't technically
errors, but not clean code (e.g. assignment to a variable that is not
used afterwards). But in my own code he found via reasoning some paths
where a null-pointer dereference could happen, or a division by zero.
That's something I don't want. BTW, clangs static checker finds also
both things in barebox, I've had not yet the time to check if they are
indeed possible. He also finds various places of usage of initialized
variables. Some of them I checked, and they have been true. In the
HTML output he writes exactly what circumstances must be valid to
reach that specific point in the code. You cannot easily see that from
what it spits to stdout.



More information about the barebox mailing list