Error while compiling a Linux Kernel (kernel/arch/arm/mach-tegra/tegra_cl_dvfs.c:372)

Hallo,

i am trying to compile the kernel sources for Linux For Tegra R21.2. I use a cross compiler in a virutal machine.

The following error has occurred:

/home/fabian/Jetson/kernel/arch/arm/mach-tegra/tegra_cl_dvfs.c: In function ‘cl_dvfs_calibrate’:
/home/fabian/Jetson/kernel/arch/arm/mach-tegra/tegra_cl_dvfs.c:372:8: error: ‘data’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
*data &= CL_DVFS_MONITOR_DATA_MASK;
^
/home/fabian/Jetson/kernel/arch/arm/mach-tegra/tegra_cl_dvfs.c:902:11: note: ‘data’ was declared here
u32 val, data;
^
/home/fabian/Jetson/kernel/arch/arm/mach-tegra/tegra_cl_dvfs.c: In function ‘monitor_get’:
/home/fabian/Jetson/kernel/arch/arm/mach-tegra/tegra_cl_dvfs.c:372:8: error: ‘v’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
*data &= CL_DVFS_MONITOR_DATA_MASK;
^
/home/fabian/Jetson/kernel/arch/arm/mach-tegra/tegra_cl_dvfs.c:2949:6: note: ‘v’ was declared here
u32 v, s;
^
cc1: all warnings being treated as errors
/home/fabian/Jetson/kernel/scripts/Makefile.build:308: recipe for target ‘arch/arm/mach-tegra/tegra_cl_dvfs.o’ failed
make[2]: *** [arch/arm/mach-tegra/tegra_cl_dvfs.o] Error 1
/home/fabian/Jetson/kernel/Makefile:800: recipe for target ‘arch/arm/mach-tegra’ failed
make[1]: *** [arch/arm/mach-tegra] Error 2
Makefile:130: recipe for target ‘sub-make’ failed
make: *** [sub-make] Error 2

Can someone help me?

p.s. sorry for my english.

What configuration are you using, e.g., from a running JTK1 /proc/config.gz, or perhaps make tegra12_defconfig? Also, which compiler (“gcc --version”)?

Depending on configuration there are some differences in how different compilers will treat some warnings/errors. I see the function is the same in R21.2 and R21.4 I tested a kernel cross-compile of the R21.2 release on Fedora 23 using the Linaro “gcc-linaro-4.8-2015.06-x86_64_arm-linux-gnueabihf” tool chain (make tegra12_defconfig, zImage and modules)…there were some warnings but compile completed. Very likely either my config did not compile that block of code (and yours did) or the compiler version treats things differently. Knowing more about your compiler version would help.

I use the JTK1 /proc/config.gz. The compiler version is 5.2.1.

I now used the Linaro “gcc-linaro-4.8-2015.06-x86_64_arm-linux-gnueabihf” tool chain and the compile completed.

Thank you very much.

FYI, the reason I chose the 4.8 gnueabihf version for Linaro cross-compile on JTK1 is because this is what was actually used in the R19.x and R21.x L4T. The 5.x tends to be ARMv8 and ARMv8a, typical of something like L4T R23.x (Jetson TX1).