diff mbox series

[08/21] clk: clkdev: Ignore suggestion to use gnu_printf() as it's not appropriate here

Message ID 20210126124540.3320214-9-lee.jones@linaro.org (mailing list archive)
State New, archived
Headers show
Series Rid W=1 warnings from Clock | expand

Commit Message

Lee Jones Jan. 26, 2021, 12:45 p.m. UTC
Fixes the following W=1 kernel build warning(s):

 drivers/clk/clkdev.c: In function ‘vclkdev_alloc’:
 drivers/clk/clkdev.c:173:3: warning: function ‘vclkdev_alloc’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]

Cc: Russell King <linux@armlinux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/clk/clkdev.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Stephen Boyd Feb. 11, 2021, 7:23 p.m. UTC | #1
Quoting Lee Jones (2021-01-26 04:45:27)
> Fixes the following W=1 kernel build warning(s):
> 
>  drivers/clk/clkdev.c: In function ‘vclkdev_alloc’:
>  drivers/clk/clkdev.c:173:3: warning: function ‘vclkdev_alloc’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
> 
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: linux-arm-kernel@lists.infradead.org
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>  drivers/clk/clkdev.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
> index 0f2e3fcf0f19f..5e5f25d568724 100644
> --- a/drivers/clk/clkdev.c
> +++ b/drivers/clk/clkdev.c
> @@ -153,6 +153,11 @@ struct clk_lookup_alloc {
>         char    con_id[MAX_CON_ID];
>  };
>  
> +#pragma GCC diagnostic push
> +#ifndef __clang__
> +#pragma GCC diagnostic ignored "-Wsuggest-attribute=format"
> +#endif

Can this be some macro banished to compiler.h?

> +
>  static struct clk_lookup * __ref
>  vclkdev_alloc(struct clk_hw *hw, const char *con_id, const char *dev_fmt,
>         va_list ap)
> @@ -177,6 +182,8 @@ vclkdev_alloc(struct clk_hw *hw, const char *con_id, const char *dev_fmt,
>         return &cla->cl;
>  }
>  
> +#pragma GCC diagnostic pop
> +
>  static struct clk_lookup *
>  vclkdev_create(struct clk_hw *hw, const char *con_id, const char *dev_fmt,
>         va_list ap)
> -- 
> 2.25.1
>
Lee Jones Feb. 12, 2021, 9:36 a.m. UTC | #2
On Thu, 11 Feb 2021, Stephen Boyd wrote:

> Quoting Lee Jones (2021-01-26 04:45:27)
> > Fixes the following W=1 kernel build warning(s):
> > 
> >  drivers/clk/clkdev.c: In function ‘vclkdev_alloc’:
> >  drivers/clk/clkdev.c:173:3: warning: function ‘vclkdev_alloc’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
> > 
> > Cc: Russell King <linux@armlinux.org.uk>
> > Cc: linux-arm-kernel@lists.infradead.org
> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> > ---
> >  drivers/clk/clkdev.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
> > index 0f2e3fcf0f19f..5e5f25d568724 100644
> > --- a/drivers/clk/clkdev.c
> > +++ b/drivers/clk/clkdev.c
> > @@ -153,6 +153,11 @@ struct clk_lookup_alloc {
> >         char    con_id[MAX_CON_ID];
> >  };
> >  
> > +#pragma GCC diagnostic push
> > +#ifndef __clang__
> > +#pragma GCC diagnostic ignored "-Wsuggest-attribute=format"
> > +#endif
> 
> Can this be some macro banished to compiler.h?

This is probably a question for Arnd.
Lee Jones March 10, 2021, 8:59 a.m. UTC | #3
On Fri, 12 Feb 2021, Lee Jones wrote:

> On Thu, 11 Feb 2021, Stephen Boyd wrote:
> 
> > Quoting Lee Jones (2021-01-26 04:45:27)
> > > Fixes the following W=1 kernel build warning(s):
> > > 
> > >  drivers/clk/clkdev.c: In function ‘vclkdev_alloc’:
> > >  drivers/clk/clkdev.c:173:3: warning: function ‘vclkdev_alloc’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
> > > 
> > > Cc: Russell King <linux@armlinux.org.uk>
> > > Cc: linux-arm-kernel@lists.infradead.org
> > > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> > > ---
> > >  drivers/clk/clkdev.c | 7 +++++++
> > >  1 file changed, 7 insertions(+)
> > > 
> > > diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
> > > index 0f2e3fcf0f19f..5e5f25d568724 100644
> > > --- a/drivers/clk/clkdev.c
> > > +++ b/drivers/clk/clkdev.c
> > > @@ -153,6 +153,11 @@ struct clk_lookup_alloc {
> > >         char    con_id[MAX_CON_ID];
> > >  };
> > >  
> > > +#pragma GCC diagnostic push
> > > +#ifndef __clang__
> > > +#pragma GCC diagnostic ignored "-Wsuggest-attribute=format"
> > > +#endif
> > 
> > Can this be some macro banished to compiler.h?
> 
> This is probably a question for Arnd.

UPDATE: Arnd and I are working on a solution for this.
diff mbox series

Patch

diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
index 0f2e3fcf0f19f..5e5f25d568724 100644
--- a/drivers/clk/clkdev.c
+++ b/drivers/clk/clkdev.c
@@ -153,6 +153,11 @@  struct clk_lookup_alloc {
 	char	con_id[MAX_CON_ID];
 };
 
+#pragma GCC diagnostic push
+#ifndef __clang__
+#pragma GCC diagnostic ignored "-Wsuggest-attribute=format"
+#endif
+
 static struct clk_lookup * __ref
 vclkdev_alloc(struct clk_hw *hw, const char *con_id, const char *dev_fmt,
 	va_list ap)
@@ -177,6 +182,8 @@  vclkdev_alloc(struct clk_hw *hw, const char *con_id, const char *dev_fmt,
 	return &cla->cl;
 }
 
+#pragma GCC diagnostic pop
+
 static struct clk_lookup *
 vclkdev_create(struct clk_hw *hw, const char *con_id, const char *dev_fmt,
 	va_list ap)