Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

soc: litex: Fix compile warning when device tree is not configured

The test robot reported:

drivers/soc/litex/litex_soc_ctrl.c:143:34: warning: unused variable 'litex_soc_ctrl_of_match' [-Wunused-const-variable]
static const struct of_device_id litex_soc_ctrl_of_match[] = {
^
1 warning generated.

As per the random config device tree is not configured causing the
litex_soc_ctrl_of_match match list to not be used. This would usually
mean that we cannot even use this driver as it depends on device tree,
but as we also have COMPILE_TEST configured we allow it.

Fix the warning by surrounding the unused variable with an ifdef
CONFIG_OF.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Stafford Horne <shorne@gmail.com>

+2 -1
+2 -1
drivers/soc/litex/litex_soc_ctrl.c
··· 140 140 void __iomem *base; 141 141 }; 142 142 143 + #ifdef CONFIG_OF 143 144 static const struct of_device_id litex_soc_ctrl_of_match[] = { 144 145 {.compatible = "litex,soc-controller"}, 145 146 {}, 146 147 }; 147 - 148 148 MODULE_DEVICE_TABLE(of, litex_soc_ctrl_of_match); 149 + #endif /* CONFIG_OF */ 149 150 150 151 static int litex_soc_ctrl_probe(struct platform_device *pdev) 151 152 {