[PATCH v2 1/2] hwspinlock: sprd: fixed warning of unused variable 'sprd_hwspinlock_of_match'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Chunyan Zhang <chunyan.zhang@xxxxxxxxxx>

The macro function of_match_ptr() is NULL if CONFIG_OF is not set, then
Clang compiler would complain the of_device_id variable is unused.

But using of_match_ptr() is space saving, for this case, the unused structure
'sprd_hwspinlock_of_match' would be not built into symbol table if CONFIG_OF
is not set, probably depends on the compiler though.

So adding __maybe_unsed seems a good approach to fix this warning.

Reported-by: kernel test robot <lkp@xxxxxxxxx>
Fixes: d8c8bbbb1aba ("hwspinlock: sprd: Add hardware spinlock driver")
Signed-off-by: Chunyan Zhang <chunyan.zhang@xxxxxxxxxx>
---
 drivers/hwspinlock/sprd_hwspinlock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwspinlock/sprd_hwspinlock.c b/drivers/hwspinlock/sprd_hwspinlock.c
index 36dc8038bbb4..4c63e2546064 100644
--- a/drivers/hwspinlock/sprd_hwspinlock.c
+++ b/drivers/hwspinlock/sprd_hwspinlock.c
@@ -138,7 +138,7 @@ static int sprd_hwspinlock_probe(struct platform_device *pdev)
 					 SPRD_HWLOCKS_NUM);
 }
 
-static const struct of_device_id sprd_hwspinlock_of_match[] = {
+static const __maybe_unused struct of_device_id sprd_hwspinlock_of_match[] = {
 	{ .compatible = "sprd,hwspinlock-r3p0", },
 	{ /* sentinel */ }
 };
-- 
2.20.1




[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux