clkdev: Supply __printf(x, y) formatting

Message ID 20221111071809.3440-1-liubo03@inspur.com
State New
Headers
Series clkdev: Supply __printf(x, y) formatting |

Commit Message

Bo Liu Nov. 11, 2022, 7:18 a.m. UTC
  Fixes the following W=1 kernel build warning(s):
  drivers/clk/clkdev.c:173:3: warning: function 'vclkdev_alloc' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
    vscnprintf(cla->dev_id, sizeof(cla->dev_id), dev_fmt, ap);
    ^~~~~~~~~~
  drivers/clk/clkdev.c:187:2: warning: function 'vclkdev_create' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
    cl = vclkdev_alloc(hw, con_id, dev_fmt, ap);
    ^~
  drivers/clk/clkdev.c:278:2: warning: function '__clk_register_clkdev' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
    cl = vclkdev_create(hw, con_id, dev_id, ap);
    ^~

Signed-off-by: Bo Liu <liubo03@inspur.com>
---
 drivers/clk/clkdev.c | 3 +++
 1 file changed, 3 insertions(+)
  

Patch

diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
index ee37d0be6877..07f5cd49f830 100644
--- a/drivers/clk/clkdev.c
+++ b/drivers/clk/clkdev.c
@@ -153,6 +153,7 @@  struct clk_lookup_alloc {
 	char	con_id[MAX_CON_ID];
 };
 
+__printf(3, 0)
 static struct clk_lookup * __ref
 vclkdev_alloc(struct clk_hw *hw, const char *con_id, const char *dev_fmt,
 	va_list ap)
@@ -177,6 +178,7 @@  vclkdev_alloc(struct clk_hw *hw, const char *con_id, const char *dev_fmt,
 	return &cla->cl;
 }
 
+__printf(3, 0)
 static struct clk_lookup *
 vclkdev_create(struct clk_hw *hw, const char *con_id, const char *dev_fmt,
 	va_list ap)
@@ -265,6 +267,7 @@  void clkdev_drop(struct clk_lookup *cl)
 }
 EXPORT_SYMBOL(clkdev_drop);
 
+__printf(3, 4)
 static struct clk_lookup *__clk_register_clkdev(struct clk_hw *hw,
 						const char *con_id,
 						const char *dev_id, ...)