[22/30] usb: typec: tcpm: fusb302: Use 'gnu_printf' format notation

Message ID 20200703174148.2749969-23-lee.jones@linaro.org
State New
Headers show
Series
  • Fix a bunch more W=1 issues in USB
Related show

Commit Message

Lee Jones July 3, 2020, 5:41 p.m.
Fixes the following W=1 kernel build warning(s):

 drivers/usb/typec/tcpm/fusb302.c: In function ‘fusb302_log’:
 drivers/usb/typec/tcpm/fusb302.c:186:2: warning: function ‘fusb302_log’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
 186 | _fusb302_log(chip, fmt, args);
 | ^~~~~~~~~~~~

Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Yueyao Zhu <yueyao.zhu@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

---
 drivers/usb/typec/tcpm/fusb302.c | 1 +
 1 file changed, 1 insertion(+)

-- 
2.25.1

Comments

Guenter Roeck July 3, 2020, 7:01 p.m. | #1
On 7/3/20 10:41 AM, Lee Jones wrote:
> Fixes the following W=1 kernel build warning(s):

> 

>  drivers/usb/typec/tcpm/fusb302.c: In function ‘fusb302_log’:

>  drivers/usb/typec/tcpm/fusb302.c:186:2: warning: function ‘fusb302_log’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]

>  186 | _fusb302_log(chip, fmt, args);

>  | ^~~~~~~~~~~~

> 

> Cc: Guenter Roeck <linux@roeck-us.net>

> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> Cc: Yueyao Zhu <yueyao.zhu@gmail.com>

> Signed-off-by: Lee Jones <lee.jones@linaro.org>


Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---

>  drivers/usb/typec/tcpm/fusb302.c | 1 +

>  1 file changed, 1 insertion(+)

> 

> diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c

> index b28facece43c4..99562cc65ca69 100644

> --- a/drivers/usb/typec/tcpm/fusb302.c

> +++ b/drivers/usb/typec/tcpm/fusb302.c

> @@ -178,6 +178,7 @@ static void _fusb302_log(struct fusb302_chip *chip, const char *fmt,

>  	mutex_unlock(&chip->logbuffer_lock);

>  }

>  

> +__printf(2, 3)

>  static void fusb302_log(struct fusb302_chip *chip, const char *fmt, ...)

>  {

>  	va_list args;

>

Patch

diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c
index b28facece43c4..99562cc65ca69 100644
--- a/drivers/usb/typec/tcpm/fusb302.c
+++ b/drivers/usb/typec/tcpm/fusb302.c
@@ -178,6 +178,7 @@  static void _fusb302_log(struct fusb302_chip *chip, const char *fmt,
 	mutex_unlock(&chip->logbuffer_lock);
 }
 
+__printf(2, 3)
 static void fusb302_log(struct fusb302_chip *chip, const char *fmt, ...)
 {
 	va_list args;