[PATCH] clkdev: Supply __printf(x, y) formatting

Bo Liu liubo03 at inspur.com
Thu Nov 10 23:18:09 PST 2022


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 at inspur.com>
---
 drivers/clk/clkdev.c | 3 +++
 1 file changed, 3 insertions(+)

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, ...)
-- 
2.27.0




More information about the linux-arm-kernel mailing list