Skip to content

Commit

Permalink
soc: litex: Fix compile warning when device tree is not configured
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Stafford Horne <[email protected]>
  • Loading branch information
stffrdhrn committed Jan 14, 2021
1 parent 7c53f6b commit e6dc077
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/soc/litex/litex_soc_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,13 @@ struct litex_soc_ctrl_device {
void __iomem *base;
};

#ifdef CONFIG_OF
static const struct of_device_id litex_soc_ctrl_of_match[] = {
{.compatible = "litex,soc-controller"},
{},
};

MODULE_DEVICE_TABLE(of, litex_soc_ctrl_of_match);
#endif /* CONFIG_OF */

static int litex_soc_ctrl_probe(struct platform_device *pdev)
{
Expand Down

0 comments on commit e6dc077

Please sign in to comment.